LOG.info("TG-IMPORTER-11006",
bean.getTargetName(), bean.getBatchId(), bean.getJobflowId(), bean.getExecutionId());
Map<String, CacheInfo> map = collectRemoteCacheInfo(bean);
for (String tableName : bean.getImportTargetTableList()) {
ImportTargetTableBean tableInfo = bean.getTargetTable(tableName);
String cacheId = tableInfo.getCacheId();
if (cacheId == null) {
assert tableInfo.getImportProtocol() != null;
continue;
}
CacheInfo currentRemoteInfo = map.get(tableInfo.getDfsFilePath());
Calendar startTimestamp = computeStartTimestamp(currentRemoteInfo, repository, tableName, tableInfo);
tableInfo.setStartTimestamp(startTimestamp);
LocalCacheInfo nextLocalInfo = new LocalCacheInfo(
cacheId,
null,
startTimestamp,
tableName,
tableInfo.getDfsFilePath());
ThunderGateCacheSupport model = createDataModelObject(tableName, tableInfo);
Calendar nextTimestamp = repository.putCacheInfo(nextLocalInfo);
CacheInfo nextRemoteInfo = new CacheInfo(
CacheInfo.FEATURE_VERSION,
cacheId,
nextTimestamp,
tableName,
tableInfo.getImportTargetColumns(),
model.getClass().getName(),
model.__tgc__DataModelVersion());
FileProtocol.Kind kind = startTimestamp == null
? FileProtocol.Kind.CREATE_CACHE
: FileProtocol.Kind.UPDATE_CACHE;
FileProtocol protocol = new FileProtocol(kind, tableInfo.getDfsFilePath(), nextRemoteInfo);
tableInfo.setImportProtocol(protocol);
}
succeed = true;
} finally {
if (succeed == false) {
repository.releaseLock(bean.getExecutionId());