01: /*
02: * DbShutdownFactory.java
03: *
04: * This file is part of SQL Workbench/J, http://www.sql-workbench.net
05: *
06: * Copyright 2002-2008, Thomas Kellerer
07: * No part of this code maybe reused without the permission of the author
08: *
09: * To contact the author please send an email to: support@sql-workbench.net
10: *
11: */
12: package workbench.db.shutdown;
13:
14: import workbench.db.WbConnection;
15:
16: /**
17: * A factory to create instances of the DbShutdownHook interface.
18: *
19: * @author support@sql-workbench.net
20: */
21: public class DbShutdownFactory {
22: /**
23: * Create a DbShutdownHook for the given connection.
24: * @param con the connection for which to create the shutdown hook
25: * @return null if not shutdown processing is necessary, an approriate instance otherwise
26: */
27: public static DbShutdownHook getShutdownHook(WbConnection con) {
28: if (con == null)
29: return null;
30:
31: if (con.getMetadata().isHsql()) {
32: return new HsqlShutdownHook();
33: } else if (con.getMetadata().isApacheDerby()) {
34: return new DerbyShutdownHook();
35: }
36: return null;
37: }
38: }
|