* {@inheritDoc}
*/
@Override
public void registerFramework(MFramework mf, Connection conn) {
if (mf.hasPersistenceId()) {
throw new SqoopException(DerbyRepoError.DERBYREPO_0011,
"Framework metadata");
}
PreparedStatement baseFormStmt = null;
PreparedStatement baseInputStmt = null;
try {
baseFormStmt = conn.prepareStatement(STMT_INSERT_FORM_BASE,
Statement.RETURN_GENERATED_KEYS);
baseInputStmt = conn.prepareStatement(STMT_INSERT_INPUT_BASE,
Statement.RETURN_GENERATED_KEYS);
// Register connector forms
registerForms(null, null, mf.getConnectionForms().getForms(),
MFormType.CONNECTION.name(), baseFormStmt, baseInputStmt);
// Register all jobs
for (MJobForms jobForms : mf.getAllJobsForms().values()) {
registerForms(null, jobForms.getType(), jobForms.getForms(),
MFormType.JOB.name(), baseFormStmt, baseInputStmt);
}
// We're using hardcoded value for framework metadata as they are
// represented as NULL in the database.
mf.setPersistenceId(1);
} catch (SQLException ex) {
logException(ex, mf);
throw new SqoopException(DerbyRepoError.DERBYREPO_0014, ex);
} finally {
closeStatements(baseFormStmt, baseInputStmt);
}
createOrUpdateFrameworkVersion(conn, mf);
}