com.joanju.cg.core
Class UpdateEngine

java.lang.Object
  extended by com.joanju.cg.core.UpdateEngine

public class UpdateEngine
extends java.lang.Object


Constructor Summary
UpdateEngine()
           
 
Method Summary
 int build(ParseUnit parseUnit)
          Build/refresh the database for a ParseUnit.
 void buildOrRefresh(java.lang.String projectName, java.util.Collection<java.io.File> compileUnitSourceFiles)
           
 int buildOrRefresh(java.lang.String projectName, java.io.File compileUnitSourceFile)
          Build or refresh the database for a given compile unit's source file.
 boolean needsUpdate(ParseUnit pu)
          Check the timestamp and layout version of the Bytecode against the PUB file for the input ParseUnit.
 void setPrecommitCallback(ICallback precommitCallback)
          Set the callback for mid-build processing.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UpdateEngine

public UpdateEngine()
             throws java.sql.SQLException,
                    java.io.IOException
Throws:
java.sql.SQLException
java.io.IOException
Method Detail

build

public int build(ParseUnit parseUnit)
          throws java.sql.SQLException,
                 java.io.IOException
Build/refresh the database for a ParseUnit. The caller is responsible for launching Checkvals after this.

Returns:
The CUID.
Throws:
java.sql.SQLException
java.io.IOException

buildOrRefresh

public int buildOrRefresh(java.lang.String projectName,
                          java.io.File compileUnitSourceFile)
                   throws java.lang.Exception
Build or refresh the database for a given compile unit's source file.

This is a convenience method, called from the API and from unit tests. It wraps the loading of the ProRefactor project, build or load the PUB, calling build(ParseUnit), and running Checkvals.

An appropriate project name (as configured in Eclipse) must be input. For example, you might use org.eclipse.core.resources.IResource.getProject().getName() to find the currently selected project name.

ProRefactor's project settings - especially PROPATH and schema names - must be configured.

Returns:
The CUID.
Throws:
java.lang.Exception

buildOrRefresh

public void buildOrRefresh(java.lang.String projectName,
                           java.util.Collection<java.io.File> compileUnitSourceFiles)
                    throws java.lang.Exception
Throws:
java.lang.Exception
See Also:
buildOrRefresh(String, File)

needsUpdate

public boolean needsUpdate(ParseUnit pu)
                    throws java.io.IOException,
                           java.sql.SQLException
Check the timestamp and layout version of the Bytecode against the PUB file for the input ParseUnit. The PUB should be checked before calling this, in case the PUB itself is out of date.

Returns:
true if the bytecode needs updating, or if the PUB file doesn't exist.
Throws:
java.io.IOException
java.sql.SQLException

setPrecommitCallback

public void setPrecommitCallback(ICallback precommitCallback)
Set the callback for mid-build processing. The precommitCallback (if not null) is passed the Codegenerator object after codegen and local values calc but before any local check vals or database writes.



Copyright © 2008 Joanju Software. All Rights Reserved.