예제 #1
0
 /**
  * Creates a new instance of the component.
  *
  * @param dataSource DataSource for accessing the database.
  * @param fileSystem Ledge file system for accessing Coral sql scripts on the classpath.
  * @param force should existing data be dropped?
  * @param logger a Logger
  * @throws SQLException
  */
 public InitComponent(DataSource dataSource, FileSystem fileSystem, boolean force, Logger logger)
     throws SQLException {
   this.dataSource = dataSource;
   this.logger = logger;
   this.dbType = DatabaseType.detect(dataSource);
   this.fileSystem = fileSystem;
   this.force = force;
 }
예제 #2
0
 private String adapt(String path) {
   String raw = path.substring(0, path.length() - 3); // strip sql suffix
   final String adapted = raw + dbType.getSuffix() + ".sql";
   if (fileSystem.exists(adapted)) {
     return adapted;
   } else {
     return path;
   }
 }