@Throws(ReplicatorException::class, InterruptedException::class) fun prepare(context: PluginContext?) { logger.info( "Import tables from " + this.uri.getPath() .toString() + " to the " + this.getDefaultSchema().toString() + " schema" ) tableNames = ArrayList<String>() columnDefinitions = HashMap<String, ArrayList<ColumnSpec>>() parser = CSVParser(',', '"') val importDirectory = File(this.uri.getPath()) if (!importDirectory.exists()) { throw ReplicatorException( "The " + this.uri.getPath().toString() + " directory does not exist" ) } for (f in importDirectory.listFiles()) { if (f.getName().endsWith(".def")) { this.prepareTableDefinition(f) } } if (this.tableNames.size() === 0) { throw ReplicatorException("There are no tables to load") } }
Prepare plug-in for use . This method is assumed to allocate all required resources . It is called before the plug-in performs any operations .