01: package com.tacitknowledge.util.migration.jdbc;
02:
03: public class MigrationLauncherFactoryLoader {
04: public static JdbcMigrationLauncherFactory createFactory() {
05: String factoryName = System.getProperties().getProperty(
06: "migration.factory");
07: if (factoryName == null)
08: factoryName = JdbcMigrationLauncherFactory.class.getName();
09: Class factoryClass = null;
10: try {
11: factoryClass = Class.forName(factoryName);
12: } catch (ClassNotFoundException e) {
13: throw new IllegalArgumentException(
14: "Migration factory class '" + factoryName
15: + "' not found. Aborting.");
16: }
17: try {
18: return (JdbcMigrationLauncherFactory) factoryClass
19: .newInstance();
20: } catch (Exception e) {
21: throw new RuntimeException(
22: "Problem while instantiating factory class '"
23: + factoryName + "'. Aborting.", e);
24: }
25: }
26: }
|