@Override
public MConnector findConnector(String shortName, Connection conn) {
if (LOG.isDebugEnabled()) {
LOG.debug("Looking up connector: " + shortName);
}
MConnector mc = null;
PreparedStatement baseConnectorFetchStmt = null;
PreparedStatement formFetchStmt = null;
PreparedStatement inputFetchStmt = null;
try {
baseConnectorFetchStmt = conn.prepareStatement(STMT_FETCH_BASE_CONNECTOR);
baseConnectorFetchStmt.setString(1, shortName);
ResultSet rsetBaseConnector = baseConnectorFetchStmt.executeQuery();
if (!rsetBaseConnector.next()) {
LOG.debug("No connector found by name: " + shortName);
return null;
}
long connectorId = rsetBaseConnector.getLong(1);
String connectorName = rsetBaseConnector.getString(2);
String connectorClassName = rsetBaseConnector.getString(3);
String connectorVersion = rsetBaseConnector.getString(4);
formFetchStmt = conn.prepareStatement(STMT_FETCH_FORM_CONNECTOR);
formFetchStmt.setLong(1, connectorId);
inputFetchStmt = conn.prepareStatement(STMT_FETCH_INPUT);
List<MForm> connectionForms = new ArrayList<MForm>();
Map<MJob.Type, List<MForm>> jobForms =
new HashMap<MJob.Type, List<MForm>>();
loadForms(connectionForms, jobForms, formFetchStmt, inputFetchStmt, 1);
mc = new MConnector(connectorName, connectorClassName, connectorVersion,
new MConnectionForms(connectionForms),
convertToJobList(jobForms));
mc.setPersistenceId(connectorId);
if (rsetBaseConnector.next()) {
throw new SqoopException(DerbyRepoError.DERBYREPO_0005, shortName);
}
} catch (SQLException ex) {