View Javadoc

1   //
2   // Copyright (c) 2004, International Decision Systems
3   // all rights reserved
4   //
5   package net.sourceforge.addam.ddlgen;
6   
7   import java.io.Writer;
8   import java.io.BufferedWriter;
9   import java.sql.Connection;
10  import java.sql.DatabaseMetaData;
11  import java.util.List;
12  
13  /**
14   * Implementations of this class are used for generating SQL/DDL scripts.
15   * @author TIM3
16   * @since Oct 9, 2005
17   */
18  public interface Generator {
19  
20      /**
21       * Return the list of objects for the given catalog and schema.
22       * @param catalog    the database object's catalog
23       * @param schema     the database object's schema
24       * @param filter     the definition of the generator (used for included/excluded objects)
25       * @param connection the database connection
26       * @param metadata   database metadata for the connection
27       * @return
28       * @throws Exception
29       */
30      public List<String> getObjects(String catalog, String schema, Filter filter,
31                                     Connection connection, DatabaseMetaData metadata) throws Exception;
32  
33      /**
34       * writes a SQL/DDL scripts for the given object to the writer
35       * @param catalog    the database object's catalog
36       * @param schema     the database object's schema
37       * @param object     the database object to generate
38       * @param vendor
39       * @param connection the database connection
40       * @param metadata   database metadata for the connection
41       * @param writer     what to write the generated SQL/DDL to
42       */
43      public void generate(String catalog, String schema, String object,
44                           String vendor, Connection connection, DatabaseMetaData metadata,
45                           BufferedWriter writer) throws Exception;
46  
47  }