org.apache.ibatis.ibator.api
Class Ibator

java.lang.Object
  extended by org.apache.ibatis.ibator.api.Ibator

public class Ibator
extends java.lang.Object

This class is the main interface to the ibator for iBATIS code generator. A typical execution of the tool involves these steps:

  1. Create an IbatorConfiguration object. The IbatorConfiguration can be the result of a parsing the XML configuration file, or it can be created solely in Java.
  2. Create an Ibator object
  3. Call one of the generate() methods

Author:
Jeff Butler
See Also:
IbatorConfigurationParser

Constructor Summary
Ibator(IbatorConfiguration ibatorConfiguration, ShellCallback shellCallback, java.util.List<java.lang.String> warnings)
          Constructs an Ibator object.
 
Method Summary
 void generate(ProgressCallback callback)
          This is the main method for generating code.
 void generate(ProgressCallback callback, java.util.Set<java.lang.String> contextIds)
          This is the main method for generating code.
 void generate(ProgressCallback callback, java.util.Set<java.lang.String> contextIds, java.util.Set<java.lang.String> fullyQualifiedTableNames)
          This is the main method for generating code.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Ibator

public Ibator(IbatorConfiguration ibatorConfiguration,
              ShellCallback shellCallback,
              java.util.List<java.lang.String> warnings)
       throws InvalidConfigurationException
Constructs an Ibator object.

Parameters:
ibatorConfiguration - The configuration for this run of ibator
shellCallback - an instance of a ShellCallback interface. You may specify null in which case ibator will use the DefaultShellCallback.
warnings - Any warnings generated during execution will be added to this list. Warnings do not affect the running of the tool, but they may affect the results. A typical warning is an unsupported data type. In that case, the column will be ignored and generation will continue. ibator will only add Strings to the list. You may specify null if you do not want warnings returned.
Throws:
InvalidConfigurationException - if the specified configuration is invalid
Method Detail

generate

public void generate(ProgressCallback callback)
              throws java.sql.SQLException,
                     java.io.IOException,
                     java.lang.InterruptedException
This is the main method for generating code. This method is long running, but progress can be provided and the method can be canceled through the ProgressCallback interface. This version of the method runs all configured contexts.

Parameters:
callback - an instance of the ProgressCallback interface, or null if you do not require progress information
Throws:
java.sql.SQLException
java.io.IOException
java.lang.InterruptedException - if the method is canceled through the ProgressCallback

generate

public void generate(ProgressCallback callback,
                     java.util.Set<java.lang.String> contextIds)
              throws java.sql.SQLException,
                     java.io.IOException,
                     java.lang.InterruptedException
This is the main method for generating code. This method is long running, but progress can be provided and the method can be canceled through the ProgressCallback interface.

Parameters:
callback - an instance of the ProgressCallback interface, or null if you do not require progress information
contextIds - a set of Strings containing context ids to run. Only the contexts with an id specified in this list will be run. If the list is null or empty, than all contexts are run.
Throws:
InvalidConfigurationException
java.sql.SQLException
java.io.IOException
java.lang.InterruptedException - if the method is canceled through the ProgressCallback

generate

public void generate(ProgressCallback callback,
                     java.util.Set<java.lang.String> contextIds,
                     java.util.Set<java.lang.String> fullyQualifiedTableNames)
              throws java.sql.SQLException,
                     java.io.IOException,
                     java.lang.InterruptedException
This is the main method for generating code. This method is long running, but progress can be provided and the method can be cancelled through the ProgressCallback interface.

Parameters:
callback - an instance of the ProgressCallback interface, or null if you do not require progress information
contextIds - a set of Strings containing context ids to run. Only the contexts with an id specified in this list will be run. If the list is null or empty, than all contexts are run.
fullyQualifiedTableNames - a set of table names to generate. The elements of the set must be Strings that exactly match what's specified in the configuration. For example, if table name = "foo" and schema = "bar", then the fully qualified table name is "foo.bar". If the Set is null or empty, then all tables in the configuration will be used for code generation.
Throws:
InvalidConfigurationException
java.sql.SQLException
java.io.IOException
java.lang.InterruptedException - if the method is canceled through the ProgressCallback