org.apache.ibatis.ibator.api
Interface ProgressCallback

All Known Implementing Classes:
AntProgressCallback, NullProgressCallback

public interface ProgressCallback

This interface can be implemented to return progress information from the file generation process. During the execution of code generation, there are three main operations: database introspection, code generation based on the results of introspection, and then merging/saving generated files. Ibator will call methods in this interface accordingly and in this order:

  1. introspectionStarted(int)
  2. (Repeatedly) startTask(String)
  3. generationStarted(int)
  4. (Repeatedly) startTask(String)
  5. saveStarted(int)
  6. (Repeatedly) startTask(String)
  7. done()

Periodically, ibator will call checkCancel() to see if the method should be canceled.

For planning purposes, the most common use case will have a ratio of 20% instrospection tasks, 40% generation tasks, and 40% save tasks.

Author:
Jeff Butler

Method Summary
 void checkCancel()
          ibator will call this method periodically during a long running method.
 void done()
          ibator calls this method when all generated files have been saved
 void generationStarted(int totalTasks)
          Called to note the start of the generation phase, and to note the maximum number of startTask messages that will be sent for the generation phase.
 void introspectionStarted(int totalTasks)
          Called to note the start of the introspection phase, and to note the maximum number of startTask messages that will be sent for the introspection phase.
 void saveStarted(int totalTasks)
          Called to note the start of the file saving phase, and to note the maximum number of startTask messages that will be sent for the file saving phase phase.
 void startTask(java.lang.String taskName)
          Called to denote the beginning of a save task
 

Method Detail

introspectionStarted

void introspectionStarted(int totalTasks)
Called to note the start of the introspection phase, and to note the maximum number of startTask messages that will be sent for the introspection phase.

Parameters:
totalTasks - the maximum number of times startTask will be called for the introspection phase.

generationStarted

void generationStarted(int totalTasks)
Called to note the start of the generation phase, and to note the maximum number of startTask messages that will be sent for the generation phase.

Parameters:
totalTasks - the maximum number of times startTask will be called for the generation phase.

saveStarted

void saveStarted(int totalTasks)
Called to note the start of the file saving phase, and to note the maximum number of startTask messages that will be sent for the file saving phase phase.

Parameters:
totalTasks - the maximum number of times startTask will be called for the file saving phase.

startTask

void startTask(java.lang.String taskName)
Called to denote the beginning of a save task

Parameters:
taskName - a descriptive name of the current work step

done

void done()
ibator calls this method when all generated files have been saved


checkCancel

void checkCancel()
                 throws java.lang.InterruptedException
ibator will call this method periodically during a long running method. If the the implementation throws InterruptedException then the method will be canceled. Any files that have already been saved will remain on the file system.

Throws:
java.lang.InterruptedException - if the operation should be halted