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