1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
17   * SOFTWARE.
18   */
19  
20  package com.liferay.portal.scheduler.quartz;
21  
22  import com.liferay.portal.kernel.log.LogFactoryUtil;
23  import com.liferay.portal.tools.sql.DB2Util;
24  import com.liferay.portal.tools.sql.DBUtil;
25  import com.liferay.portal.tools.sql.DerbyUtil;
26  import com.liferay.portal.tools.sql.HypersonicUtil;
27  import com.liferay.portal.tools.sql.PostgreSQLUtil;
28  import com.liferay.portal.tools.sql.SQLServerUtil;
29  import com.liferay.portal.tools.sql.SybaseUtil;
30  
31  import java.io.IOException;
32  
33  import java.lang.reflect.Constructor;
34  
35  import java.sql.Connection;
36  import java.sql.SQLException;
37  
38  import java.util.List;
39  import java.util.Set;
40  
41  import org.apache.commons.logging.Log;
42  
43  import org.quartz.Calendar;
44  import org.quartz.CronTrigger;
45  import org.quartz.JobDataMap;
46  import org.quartz.JobDetail;
47  import org.quartz.SimpleTrigger;
48  import org.quartz.Trigger;
49  import org.quartz.impl.jdbcjobstore.CloudscapeDelegate;
50  import org.quartz.impl.jdbcjobstore.DB2v7Delegate;
51  import org.quartz.impl.jdbcjobstore.HSQLDBDelegate;
52  import org.quartz.impl.jdbcjobstore.MSSQLDelegate;
53  import org.quartz.impl.jdbcjobstore.PostgreSQLDelegate;
54  import org.quartz.impl.jdbcjobstore.StdJDBCDelegate;
55  import org.quartz.spi.ClassLoadHelper;
56  import org.quartz.utils.Key;
57  import org.quartz.utils.TriggerStatus;
58  
59  /**
60   * <a href="DynamicDriverDelegate.java.html"><b><i>View Source</i></b></a>
61   *
62   * @author Brian Wing Shun Chan
63   *
64   */
65  public class DynamicDriverDelegate extends StdJDBCDelegate {
66  
67      public DynamicDriverDelegate(
68          Log logger, String tablePrefix, String instanceId) {
69  
70          super(logger, tablePrefix, instanceId);
71  
72          try {
73              Class<?> driverDelegateClass = getDriverDelegateClass();
74  
75              Constructor<?> driverDelegateConstructor =
76                  driverDelegateClass.getConstructor(
77                      Log.class, String.class, String.class);
78  
79              _jdbcDelegate =
80                  (StdJDBCDelegate)driverDelegateConstructor.newInstance(
81                      logger, tablePrefix, instanceId);
82          }
83          catch (Exception e) {
84              _log.error(e, e);
85          }
86      }
87  
88      public DynamicDriverDelegate(
89          Log logger, String tablePrefix, String instanceId,
90          Boolean useProperties) {
91  
92          super(logger, tablePrefix, instanceId, useProperties);
93  
94          try {
95              Class<?> driverDelegateClass = getDriverDelegateClass();
96  
97              Constructor<?> driverDelegateConstructor =
98                  driverDelegateClass.getConstructor(
99                      Log.class, String.class, String.class, Boolean.class);
100 
101             _jdbcDelegate =
102                 (StdJDBCDelegate)driverDelegateConstructor.newInstance(
103                     logger, tablePrefix, instanceId, useProperties);
104         }
105         catch (Exception e) {
106             _log.error(e, e);
107         }
108     }
109 
110     public boolean calendarExists(Connection conn, String calendarName)
111         throws SQLException {
112 
113         return _jdbcDelegate.calendarExists(conn, calendarName);
114     }
115 
116     public boolean calendarIsReferenced(Connection conn, String calendarName)
117         throws SQLException {
118 
119         return _jdbcDelegate.calendarIsReferenced(conn, calendarName);
120     }
121 
122     public int countMisfiredTriggersInStates(
123             Connection conn, String state1, String state2, long ts)
124         throws SQLException {
125 
126         return _jdbcDelegate.countMisfiredTriggersInStates(
127             conn, state1, state2, ts);
128     }
129 
130     public int deleteAllPausedTriggerGroups(Connection arg0)
131         throws SQLException {
132 
133         return _jdbcDelegate.deleteAllPausedTriggerGroups(arg0);
134     }
135 
136     public int deleteBlobTrigger(
137             Connection conn, String triggerName, String groupName)
138         throws SQLException {
139 
140         return _jdbcDelegate.deleteBlobTrigger(conn, triggerName, groupName);
141     }
142 
143     public int deleteCalendar(Connection conn, String calendarName)
144         throws SQLException {
145 
146         return _jdbcDelegate.deleteCalendar(conn, calendarName);
147     }
148 
149     public int deleteCronTrigger(
150             Connection conn, String triggerName, String groupName)
151         throws SQLException {
152 
153         return _jdbcDelegate.deleteCronTrigger(conn, triggerName, groupName);
154     }
155 
156     public int deleteFiredTrigger(Connection conn, String entryId)
157         throws SQLException {
158 
159         return _jdbcDelegate.deleteFiredTrigger(conn, entryId);
160     }
161 
162     public int deleteFiredTriggers(Connection conn) throws SQLException {
163         return _jdbcDelegate.deleteFiredTriggers(conn);
164     }
165 
166     public int deleteFiredTriggers(Connection conn, String instanceId)
167         throws SQLException {
168 
169         return _jdbcDelegate.deleteFiredTriggers(conn, instanceId);
170     }
171 
172     public int deleteJobDetail(
173             Connection conn, String jobName, String groupName)
174         throws SQLException {
175 
176         return _jdbcDelegate.deleteJobDetail(conn, jobName, groupName);
177     }
178 
179     public int deleteJobListeners(
180             Connection conn, String jobName, String groupName)
181         throws SQLException {
182 
183         return _jdbcDelegate.deleteJobListeners(conn, jobName, groupName);
184     }
185 
186     public int deletePausedTriggerGroup(Connection arg0, String arg1)
187         throws SQLException {
188 
189         return _jdbcDelegate.deletePausedTriggerGroup(arg0, arg1);
190     }
191 
192     public int deleteSchedulerState(Connection conn, String instanceId)
193         throws SQLException {
194 
195         return _jdbcDelegate.deleteSchedulerState(conn, instanceId);
196     }
197 
198     public int deleteSimpleTrigger(
199             Connection conn, String triggerName, String groupName)
200         throws SQLException {
201 
202         return _jdbcDelegate.deleteSimpleTrigger(conn, triggerName, groupName);
203     }
204 
205     public int deleteTrigger(
206             Connection conn, String triggerName, String groupName)
207         throws SQLException {
208 
209         return _jdbcDelegate.deleteTrigger(conn, triggerName, groupName);
210     }
211 
212     public int deleteTriggerListeners(
213             Connection conn, String triggerName, String groupName)
214         throws SQLException {
215 
216         return _jdbcDelegate.deleteTriggerListeners(
217             conn, triggerName, groupName);
218     }
219 
220     public int deleteVolatileFiredTriggers(Connection conn)
221         throws SQLException {
222 
223         return _jdbcDelegate.deleteVolatileFiredTriggers(conn);
224     }
225 
226     public int insertBlobTrigger(Connection arg0, Trigger arg1)
227         throws SQLException, IOException {
228 
229         return _jdbcDelegate.insertBlobTrigger(arg0, arg1);
230     }
231 
232     public int insertCalendar(
233             Connection conn, String calendarName, Calendar calendar)
234         throws IOException, SQLException {
235 
236         return _jdbcDelegate.insertCalendar(conn, calendarName, calendar);
237     }
238 
239     public int insertCronTrigger(Connection conn, CronTrigger trigger)
240         throws SQLException {
241 
242         return _jdbcDelegate.insertCronTrigger(conn, trigger);
243     }
244 
245     public int insertFiredTrigger(
246             Connection conn, Trigger trigger, String state, JobDetail job)
247         throws SQLException {
248 
249         return _jdbcDelegate.insertFiredTrigger(conn, trigger, state, job);
250     }
251 
252     public int insertJobDetail(Connection arg0, JobDetail arg1)
253         throws IOException, SQLException {
254 
255         return _jdbcDelegate.insertJobDetail(arg0, arg1);
256     }
257 
258     public int insertJobListener(
259             Connection conn, JobDetail job, String listener)
260         throws SQLException {
261 
262         return _jdbcDelegate.insertJobListener(conn, job, listener);
263     }
264 
265     public int insertPausedTriggerGroup(Connection arg0, String arg1)
266         throws SQLException {
267 
268         return _jdbcDelegate.insertPausedTriggerGroup(arg0, arg1);
269     }
270 
271     public int insertSchedulerState(
272             Connection conn, String instanceId, long checkInTime, long interval)
273         throws SQLException {
274 
275         return _jdbcDelegate.insertSchedulerState(
276             conn, instanceId, checkInTime, interval);
277     }
278 
279     public int insertSimpleTrigger(Connection conn, SimpleTrigger trigger)
280         throws SQLException {
281 
282         return _jdbcDelegate.insertSimpleTrigger(conn, trigger);
283     }
284 
285     public int insertTrigger(
286             Connection arg0, Trigger arg1, String arg2, JobDetail arg3)
287         throws SQLException, IOException {
288 
289         return _jdbcDelegate.insertTrigger(arg0, arg1, arg2, arg3);
290     }
291 
292     public int insertTriggerListener(
293             Connection conn, Trigger trigger, String listener)
294         throws SQLException {
295 
296         return _jdbcDelegate.insertTriggerListener(conn, trigger, listener);
297     }
298 
299     public boolean isExistingTriggerGroup(Connection conn, String groupName)
300         throws SQLException {
301 
302         return _jdbcDelegate.isExistingTriggerGroup(conn, groupName);
303     }
304 
305     public boolean isJobStateful(
306             Connection conn, String jobName, String groupName)
307         throws SQLException {
308 
309         return _jdbcDelegate.isJobStateful(conn, jobName, groupName);
310     }
311 
312     public boolean isTriggerGroupPaused(Connection conn, String groupName)
313         throws SQLException {
314 
315         return _jdbcDelegate.isTriggerGroupPaused(conn, groupName);
316     }
317 
318     public boolean jobExists(Connection conn, String jobName, String groupName)
319         throws SQLException {
320 
321         return _jdbcDelegate.jobExists(conn, jobName, groupName);
322     }
323 
324     public Calendar selectCalendar(Connection arg0, String arg1)
325         throws ClassNotFoundException, IOException, SQLException {
326 
327         return _jdbcDelegate.selectCalendar(arg0, arg1);
328     }
329 
330     public String[] selectCalendars(Connection arg0) throws SQLException {
331         return _jdbcDelegate.selectCalendars(arg0);
332     }
333 
334     public Set selectFiredTriggerInstanceNames(Connection arg0)
335         throws SQLException {
336 
337         return _jdbcDelegate.selectFiredTriggerInstanceNames(arg0);
338     }
339 
340     public List selectFiredTriggerRecords(
341             Connection arg0, String arg1, String arg2)
342         throws SQLException {
343 
344         return _jdbcDelegate.selectFiredTriggerRecords(arg0, arg1, arg2);
345     }
346 
347     public List selectFiredTriggerRecordsByJob(
348             Connection arg0, String arg1, String arg2)
349         throws SQLException {
350 
351         return _jdbcDelegate.selectFiredTriggerRecordsByJob(arg0, arg1, arg2);
352     }
353 
354     public List selectInstancesFiredTriggerRecords(Connection arg0, String arg1)
355         throws SQLException {
356 
357         return _jdbcDelegate.selectInstancesFiredTriggerRecords(arg0, arg1);
358     }
359 
360     public JobDetail selectJobDetail(
361             Connection arg0, String arg1, String arg2, ClassLoadHelper arg3)
362         throws ClassNotFoundException, IOException, SQLException {
363 
364         return _jdbcDelegate.selectJobDetail(arg0, arg1, arg2, arg3);
365     }
366 
367     public int selectJobExecutionCount(
368             Connection conn, String jobName, String jobGroup)
369         throws SQLException {
370 
371         return _jdbcDelegate.selectJobExecutionCount(conn, jobName, jobGroup);
372     }
373 
374     public JobDetail selectJobForTrigger(
375             Connection arg0, String arg1, String arg2, ClassLoadHelper arg3)
376         throws ClassNotFoundException, SQLException {
377 
378         return _jdbcDelegate.selectJobForTrigger(arg0, arg1, arg2, arg3);
379     }
380 
381     public String[] selectJobGroups(Connection arg0) throws SQLException {
382         return _jdbcDelegate.selectJobGroups(arg0);
383     }
384 
385     public String[] selectJobListeners(
386             Connection arg0, String arg1, String arg2)
387         throws SQLException {
388 
389         return _jdbcDelegate.selectJobListeners(arg0, arg1, arg2);
390     }
391 
392     public String[] selectJobsInGroup(Connection arg0, String arg1)
393         throws SQLException {
394 
395         return _jdbcDelegate.selectJobsInGroup(arg0, arg1);
396     }
397 
398     public Key[] selectMisfiredTriggers(Connection arg0, long arg1)
399         throws SQLException {
400 
401         return _jdbcDelegate.selectMisfiredTriggers(arg0, arg1);
402     }
403 
404     public Key[] selectMisfiredTriggersInGroupInState(
405             Connection arg0, String arg1, String arg2, long arg3)
406         throws SQLException {
407 
408         return _jdbcDelegate.selectMisfiredTriggersInGroupInState(
409             arg0, arg1, arg2, arg3);
410     }
411 
412     public Key[] selectMisfiredTriggersInState(
413             Connection arg0, String arg1, long arg2)
414         throws SQLException {
415 
416         return _jdbcDelegate.selectMisfiredTriggersInState(arg0, arg1, arg2);
417     }
418 
419     public boolean selectMisfiredTriggersInStates(
420             Connection arg0, String arg1, String arg2, long arg3, int arg4,
421             List arg5)
422         throws SQLException {
423 
424         return _jdbcDelegate.selectMisfiredTriggersInStates(
425             arg0, arg1, arg2, arg3, arg4, arg5);
426     }
427 
428     public long selectNextFireTime(Connection conn) throws SQLException {
429         return _jdbcDelegate.selectNextFireTime(conn);
430     }
431 
432     public int selectNumCalendars(Connection arg0) throws SQLException {
433         return _jdbcDelegate.selectNumCalendars(arg0);
434     }
435 
436     public int selectNumJobs(Connection arg0) throws SQLException {
437         return _jdbcDelegate.selectNumJobs(arg0);
438     }
439 
440     public int selectNumTriggers(Connection arg0) throws SQLException {
441         return _jdbcDelegate.selectNumTriggers(arg0);
442     }
443 
444     public int selectNumTriggersForJob(
445             Connection conn, String jobName, String groupName)
446         throws SQLException {
447 
448         return _jdbcDelegate.selectNumTriggersForJob(conn, jobName, groupName);
449     }
450 
451     public Set selectPausedTriggerGroups(Connection arg0) throws SQLException {
452         return _jdbcDelegate.selectPausedTriggerGroups(arg0);
453     }
454 
455     public List selectSchedulerStateRecords(Connection arg0, String arg1)
456         throws SQLException {
457 
458         return _jdbcDelegate.selectSchedulerStateRecords(arg0, arg1);
459     }
460 
461     public List selectStatefulJobsOfTriggerGroup(
462             Connection conn, String groupName)
463         throws SQLException {
464 
465         return _jdbcDelegate.selectStatefulJobsOfTriggerGroup(conn, groupName);
466     }
467 
468     public Trigger selectTrigger(Connection arg0, String arg1, String arg2)
469         throws SQLException, ClassNotFoundException, IOException {
470 
471         return _jdbcDelegate.selectTrigger(arg0, arg1, arg2);
472     }
473 
474     public Key selectTriggerForFireTime(Connection conn, long fireTime)
475         throws SQLException {
476 
477         return _jdbcDelegate.selectTriggerForFireTime(conn, fireTime);
478     }
479 
480     public String[] selectTriggerGroups(Connection arg0)
481         throws SQLException {
482 
483         return _jdbcDelegate.selectTriggerGroups(arg0);
484     }
485 
486     public JobDataMap selectTriggerJobDataMap(
487             Connection arg0, String arg1, String arg2)
488         throws SQLException, ClassNotFoundException, IOException {
489 
490         return _jdbcDelegate.selectTriggerJobDataMap(arg0, arg1, arg2);
491     }
492 
493     public String[] selectTriggerListeners(
494             Connection arg0, String arg1, String arg2)
495         throws SQLException {
496 
497         return _jdbcDelegate.selectTriggerListeners(arg0, arg1, arg2);
498     }
499 
500     public Key[] selectTriggerNamesForJob(
501             Connection arg0, String arg1, String arg2)
502         throws SQLException {
503 
504         return _jdbcDelegate.selectTriggerNamesForJob(arg0, arg1, arg2);
505     }
506 
507     public Trigger[] selectTriggersForCalendar(Connection conn, String calName)
508         throws SQLException, ClassNotFoundException, IOException {
509 
510         return _jdbcDelegate.selectTriggersForCalendar(conn, calName);
511     }
512 
513     public Trigger[] selectTriggersForJob(
514             Connection arg0, String arg1, String arg2)
515         throws SQLException, ClassNotFoundException, IOException {
516 
517         return _jdbcDelegate.selectTriggersForJob(arg0, arg1, arg2);
518     }
519 
520     public Trigger[] selectTriggersForRecoveringJobs(Connection arg0)
521         throws SQLException, IOException, ClassNotFoundException {
522 
523         return _jdbcDelegate.selectTriggersForRecoveringJobs(arg0);
524     }
525 
526     public String[] selectTriggersInGroup(Connection arg0, String arg1)
527         throws SQLException {
528 
529         return _jdbcDelegate.selectTriggersInGroup(arg0, arg1);
530     }
531 
532     public Key[] selectTriggersInState(Connection arg0, String arg1)
533         throws SQLException {
534 
535         return _jdbcDelegate.selectTriggersInState(arg0, arg1);
536     }
537 
538     public String selectTriggerState(Connection arg0, String arg1, String arg2)
539         throws SQLException {
540 
541         return _jdbcDelegate.selectTriggerState(arg0, arg1, arg2);
542     }
543 
544     public TriggerStatus selectTriggerStatus(
545             Connection arg0, String arg1, String arg2)
546         throws SQLException {
547 
548         return _jdbcDelegate.selectTriggerStatus(arg0, arg1, arg2);
549     }
550 
551     public Key selectTriggerToAcquire(
552             Connection conn, long noLaterThan, long noEarlierThan)
553         throws SQLException {
554 
555         return _jdbcDelegate.selectTriggerToAcquire(
556             conn, noLaterThan, noEarlierThan);
557     }
558 
559     public Key[] selectVolatileJobs(Connection arg0) throws SQLException {
560         return _jdbcDelegate.selectVolatileJobs(arg0);
561     }
562 
563     public Key[] selectVolatileTriggers(Connection arg0) throws SQLException {
564         return _jdbcDelegate.selectVolatileTriggers(arg0);
565     }
566 
567     public boolean triggerExists(
568             Connection conn, String triggerName, String groupName)
569         throws SQLException {
570 
571         return _jdbcDelegate.triggerExists(conn, triggerName, groupName);
572     }
573 
574     public int updateBlobTrigger(Connection arg0, Trigger arg1)
575         throws SQLException, IOException {
576 
577         return _jdbcDelegate.updateBlobTrigger(arg0, arg1);
578     }
579 
580     public int updateCalendar(
581             Connection conn, String calendarName, Calendar calendar)
582         throws IOException, SQLException {
583 
584         return _jdbcDelegate.updateCalendar(conn, calendarName, calendar);
585     }
586 
587     public int updateCronTrigger(Connection conn, CronTrigger trigger)
588         throws SQLException {
589 
590         return _jdbcDelegate.updateCronTrigger(conn, trigger);
591     }
592 
593     public int updateJobData(Connection conn, JobDetail job)
594         throws IOException, SQLException {
595 
596         return _jdbcDelegate.updateJobData(conn, job);
597     }
598 
599     public int updateJobDetail(Connection arg0, JobDetail arg1)
600         throws IOException, SQLException {
601 
602         return _jdbcDelegate.updateJobDetail(arg0, arg1);
603     }
604 
605     public int updateSchedulerState(
606             Connection conn, String instanceId, long checkInTime)
607         throws SQLException {
608 
609         return _jdbcDelegate.updateSchedulerState(
610             conn, instanceId, checkInTime);
611     }
612 
613     public int updateSimpleTrigger(Connection conn, SimpleTrigger trigger)
614         throws SQLException {
615 
616         return _jdbcDelegate.updateSimpleTrigger(conn, trigger);
617     }
618 
619     public int updateTrigger(
620             Connection arg0, Trigger arg1, String arg2, JobDetail arg3)
621         throws SQLException, IOException {
622 
623         return _jdbcDelegate.updateTrigger(arg0, arg1, arg2, arg3);
624     }
625 
626     public int updateTriggerGroupStateFromOtherState(
627             Connection conn, String groupName, String newState, String oldState)
628         throws SQLException {
629 
630         return _jdbcDelegate.updateTriggerGroupStateFromOtherState(
631             conn, groupName, newState, oldState);
632     }
633 
634     public int updateTriggerGroupStateFromOtherStates(
635             Connection conn, String groupName, String newState,
636             String oldState1, String oldState2, String oldState3)
637         throws SQLException {
638 
639         return _jdbcDelegate.updateTriggerGroupStateFromOtherStates(
640             conn, groupName, newState, oldState1, oldState2, oldState3);
641     }
642 
643     public int updateTriggerState(
644             Connection conn, String triggerName, String groupName, String state)
645         throws SQLException {
646 
647         return _jdbcDelegate.updateTriggerState(
648             conn, triggerName, groupName, state);
649     }
650 
651     public int updateTriggerStateFromOtherState(
652             Connection conn, String triggerName, String groupName,
653             String newState, String oldState)
654         throws SQLException {
655 
656         return _jdbcDelegate.updateTriggerStateFromOtherState(
657             conn, triggerName, groupName, newState, oldState);
658     }
659 
660     public int updateTriggerStateFromOtherStates(
661             Connection conn, String triggerName, String groupName,
662             String newState, String oldState1, String oldState2,
663             String oldState3)
664         throws SQLException {
665 
666         return _jdbcDelegate.updateTriggerStateFromOtherStates(
667             conn, triggerName, groupName, newState, oldState1, oldState2,
668             oldState3);
669     }
670 
671     public int updateTriggerStateFromOtherStatesBeforeTime(
672             Connection conn, String newState, String oldState1,
673             String oldState2, long time)
674         throws SQLException {
675 
676         return _jdbcDelegate.updateTriggerStateFromOtherStatesBeforeTime(
677             conn, newState, oldState1, oldState2, time);
678     }
679 
680     public int updateTriggerStatesForJob(
681             Connection conn, String jobName, String groupName, String state)
682         throws SQLException {
683 
684         return _jdbcDelegate.updateTriggerStatesForJob(
685             conn, jobName, groupName, state);
686     }
687 
688     public int updateTriggerStatesForJobFromOtherState(
689             Connection conn, String jobName, String groupName, String state,
690             String oldState)
691         throws SQLException {
692 
693         return _jdbcDelegate.updateTriggerStatesForJobFromOtherState(
694             conn, jobName, groupName, state, oldState);
695     }
696 
697     public int updateTriggerStatesFromOtherStates(
698             Connection conn, String newState, String oldState1,
699             String oldState2)
700         throws SQLException {
701 
702         return _jdbcDelegate.updateTriggerStatesFromOtherStates(
703             conn, newState, oldState1, oldState2);
704     }
705 
706     protected Class<?> getDriverDelegateClass() {
707         Class<?> driverDelegateClass = StdJDBCDelegate.class;
708 
709         DBUtil dbUtil = DBUtil.getInstance();
710 
711         if (dbUtil instanceof DB2Util) {
712             driverDelegateClass = DB2v7Delegate.class;
713         }
714         else if (dbUtil instanceof DerbyUtil) {
715             driverDelegateClass = CloudscapeDelegate.class;
716         }
717         else if (dbUtil instanceof HypersonicUtil) {
718             driverDelegateClass = HSQLDBDelegate.class;
719         }
720         else if (dbUtil instanceof PostgreSQLUtil) {
721             driverDelegateClass = PostgreSQLDelegate.class;
722         }
723         else if (dbUtil instanceof SQLServerUtil) {
724             driverDelegateClass = MSSQLDelegate.class;
725         }
726         else if (dbUtil instanceof SybaseUtil) {
727             driverDelegateClass = MSSQLDelegate.class;
728         }
729 
730         return driverDelegateClass;
731     }
732 
733     private com.liferay.portal.kernel.log.Log _log =
734         LogFactoryUtil.getLog(DynamicDriverDelegate.class);
735 
736     private StdJDBCDelegate _jdbcDelegate;
737 
738 }