/** * Synchronize append. * * @param dataModel * the data model * @throws SynchronizationException * the synchronization exception */ private void synchronizeAppend(DataStructureDataAppendModel dataModel) throws SynchronizationException { try { if (!dataStructuresCoreService.existsAppend(dataModel.getLocation())) { dataStructuresCoreService.createAppend(dataModel.getLocation(), dataModel.getName(), dataModel.getHash()); DATA_STRUCTURE_APPEND_MODELS.put(dataModel.getName(), dataModel); logger.info("Synchronized a new Append Data file [{}] from location: {}", dataModel.getName(), dataModel.getLocation()); } else { DataStructureDataAppendModel existing = dataStructuresCoreService.getAppend(dataModel.getLocation()); if (!dataModel.equals(existing)) { dataStructuresCoreService.updateAppend(dataModel.getLocation(), dataModel.getName(), dataModel.getHash()); DATA_STRUCTURE_APPEND_MODELS.put(dataModel.getName(), dataModel); logger.info("Synchronized a modified Append Data file [{}] from location: {}", dataModel.getName(), dataModel.getLocation()); } } APPEND_SYNCHRONIZED.add(dataModel.getLocation()); } catch (DataStructuresException e) { throw new SynchronizationException(e); } }
/** * Synchronize delete. * * @param dataModel * the data model * @throws SynchronizationException * the synchronization exception */ private void synchronizeDelete(DataStructureDataDeleteModel dataModel) throws SynchronizationException { try { if (!dataStructuresCoreService.existsDelete(dataModel.getLocation())) { dataStructuresCoreService.createDelete(dataModel.getLocation(), dataModel.getName(), dataModel.getHash()); DATA_STRUCTURE_DELETE_MODELS.put(dataModel.getName(), dataModel); logger.info("Synchronized a new Delete Data file [{}] from location: {}", dataModel.getName(), dataModel.getLocation()); } else { DataStructureDataDeleteModel existing = dataStructuresCoreService.getDelete(dataModel.getLocation()); if (!dataModel.equals(existing)) { dataStructuresCoreService.updateDelete(dataModel.getLocation(), dataModel.getName(), dataModel.getHash()); DATA_STRUCTURE_DELETE_MODELS.put(dataModel.getName(), dataModel); logger.info("Synchronized a modified Delete Data file [{}] from location: {}", dataModel.getName(), dataModel.getLocation()); } } DELETE_SYNCHRONIZED.add(dataModel.getLocation()); } catch (DataStructuresException e) { throw new SynchronizationException(e); } }
/** * Synchronize replace. * * @param dataModel * the data model * @throws SynchronizationException * the synchronization exception */ private void synchronizeReplace(DataStructureDataReplaceModel dataModel) throws SynchronizationException { try { if (!dataStructuresCoreService.existsReplace(dataModel.getLocation())) { dataStructuresCoreService.createReplace(dataModel.getLocation(), dataModel.getName(), dataModel.getHash()); DATA_STRUCTURE_REPLACE_MODELS.put(dataModel.getName(), dataModel); logger.info("Synchronized a new Replace Data file [{}] from location: {}", dataModel.getName(), dataModel.getLocation()); } else { DataStructureDataReplaceModel existing = dataStructuresCoreService.getReplace(dataModel.getLocation()); if (!dataModel.equals(existing)) { dataStructuresCoreService.updateReplace(dataModel.getLocation(), dataModel.getName(), dataModel.getHash()); DATA_STRUCTURE_REPLACE_MODELS.put(dataModel.getName(), dataModel); logger.info("Synchronized a modified Replace Data file [{}] from location: {}", dataModel.getName(), dataModel.getLocation()); } } REPLACE_SYNCHRONIZED.add(dataModel.getLocation()); } catch (DataStructuresException e) { throw new SynchronizationException(e); } }
/** * Synchronize update. * * @param dataModel * the data model * @throws SynchronizationException * the synchronization exception */ private void synchronizeUpdate(DataStructureDataUpdateModel dataModel) throws SynchronizationException { try { if (!dataStructuresCoreService.existsUpdate(dataModel.getLocation())) { dataStructuresCoreService.createUpdate(dataModel.getLocation(), dataModel.getName(), dataModel.getHash()); DATA_STRUCTURE_UPDATE_MODELS.put(dataModel.getName(), dataModel); logger.info("Synchronized a new Update Data file [{}] from location: {}", dataModel.getName(), dataModel.getLocation()); } else { DataStructureDataUpdateModel existing = dataStructuresCoreService.getUpdate(dataModel.getLocation()); if (!dataModel.equals(existing)) { dataStructuresCoreService.updateUpdate(dataModel.getLocation(), dataModel.getName(), dataModel.getHash()); DATA_STRUCTURE_UPDATE_MODELS.put(dataModel.getName(), dataModel); logger.info("Synchronized a modified Update Data file [{}] from location: {}", dataModel.getName(), dataModel.getLocation()); } } UPDATE_SYNCHRONIZED.add(dataModel.getLocation()); } catch (DataStructuresException e) { throw new SynchronizationException(e); } }
if (!dataStructuresCoreService.existsTable(tableModel.getLocation())) { DataStructureTableModel duplicated = dataStructuresCoreService.getTableByName(tableModel.getName()); if (duplicated != null) { throw new SynchronizationException( tableModel.getLocation(), duplicated.getLocation())); dataStructuresCoreService.createTable(tableModel.getLocation(), tableModel.getName(), tableModel.getHash()); DATA_STRUCTURE_MODELS.put(tableModel.getName(), tableModel); logger.info("Synchronized a new Table [{}] from location: {}", tableModel.getName(), tableModel.getLocation()); } else { DataStructureTableModel existing = dataStructuresCoreService.getTable(tableModel.getLocation()); if (!tableModel.equals(existing)) { dataStructuresCoreService.updateTable(tableModel.getLocation(), tableModel.getName(), tableModel.getHash()); DATA_STRUCTURE_MODELS.put(tableModel.getName(), tableModel); logger.info("Synchronized a modified Table [{}] from location: {}", tableModel.getName(), tableModel.getLocation());
if (!dataStructuresCoreService.existsView(viewModel.getLocation())) { DataStructureViewModel duplicated = dataStructuresCoreService.getViewByName(viewModel.getName()); if (duplicated != null) { throw new SynchronizationException( viewModel.getLocation(), duplicated.getLocation())); dataStructuresCoreService.createView(viewModel.getLocation(), viewModel.getName(), viewModel.getHash()); DATA_STRUCTURE_MODELS.put(viewModel.getName(), viewModel); logger.info("Synchronized a new View [{}] from location: {}", viewModel.getName(), viewModel.getLocation()); } else { DataStructureViewModel existing = dataStructuresCoreService.getView(viewModel.getLocation()); if (!viewModel.equals(existing)) { dataStructuresCoreService.updateView(viewModel.getLocation(), viewModel.getName(), viewModel.getHash()); DATA_STRUCTURE_MODELS.put(viewModel.getName(), viewModel); logger.info("Synchronized a modified View [{}] from location: {}", viewModel.getName(), viewModel.getLocation());
/** * Synchronize schema. * * @param schemaModel * the schema model * @throws SynchronizationException * the synchronization exception */ private void synchronizeSchema(DataStructureSchemaModel schemaModel) throws SynchronizationException { try { if (!dataStructuresCoreService.existsSchema(schemaModel.getLocation())) { dataStructuresCoreService.createSchema(schemaModel.getLocation(), schemaModel.getName(), schemaModel.getHash()); DATA_STRUCTURE_SCHEMA_MODELS.put(schemaModel.getName(), schemaModel); addDataStructureModelsFromSchema(schemaModel); logger.info("Synchronized a new Schema file [{}] from location: {}", schemaModel.getName(), schemaModel.getLocation()); } else { DataStructureSchemaModel existing = dataStructuresCoreService.getSchema(schemaModel.getLocation()); if (!schemaModel.equals(existing)) { dataStructuresCoreService.updateSchema(schemaModel.getLocation(), schemaModel.getName(), schemaModel.getHash()); DATA_STRUCTURE_SCHEMA_MODELS.put(schemaModel.getName(), schemaModel); addDataStructureModelsFromSchema(schemaModel); logger.info("Synchronized a modified Schema file [{}] from location: {}", schemaModel.getName(), schemaModel.getLocation()); } } SCHEMA_SYNCHRONIZED.add(schemaModel.getLocation()); } catch (DataStructuresException e) { throw new SynchronizationException(e); } }