@Service(value="dataSynchroService") @Lazy public class DataSynchroServiceImpl extends SynchroBaseService implements DataSynchroService
batchSize, config, daoInterceptors, dataSource
Constructor and Description |
---|
DataSynchroServiceImpl() |
DataSynchroServiceImpl(DataSource dataSource,
SynchroConfiguration config) |
Modifier and Type | Method and Description |
---|---|
SynchroContext |
createSynchroContext(File sourceDbDirectory)
Create a synchro context, from a source database directory (HSQLDB only).
|
SynchroContext |
createSynchroContext(Properties sourceConnectionProperties)
Create a synchro context, using configuration properties for target and source properties.
|
protected Properties |
getRemoteProperties(File dbDirectory) |
void |
prepare(SynchroContext synchroContext)
Prepare the synchronize operation from the target data database supported
by this service, says just compute nb rows to update for each table and
update the result model.
|
protected void |
prepareRootTable(SynchroTableMetadata sourceTable,
SynchroTableMetadata targetTable,
Connection sourceConnection,
Connection targetConnection,
SynchroResult result) |
void |
synchronize(SynchroContext synchroContext)
Launch the synchronize operation from the target data database supported
by this service.
|
protected void |
synchronizeChildTable(SynchroTableMetadata table,
String joinColumnName,
Set<Integer> joinColumnIds,
Connection sourceConnection,
Connection targetConnection,
SynchroResult result,
SynchroPendingOperationBuffer tableBuffer) |
protected void |
synchronizeChildTables(SynchroTableMetadata parentTable,
Set<Integer> parentRemoteIds,
SynchroContext context,
Connection sourceConnection,
Connection targetConnection,
SynchroResult result,
boolean enableLogCount) |
protected void |
synchronizeRootTable(SynchroTableMetadata table,
SynchroContext context,
Connection sourceConnection,
Connection targetConnection,
SynchroResult result,
SynchroPendingOperationBuffer tableBuffer) |
protected void |
updateTableNoRemoteId(SynchroTableDao targetDao,
ResultSet incomingData,
SynchroResult result,
SynchroPendingOperationBuffer tableBuffer)
To update the content of the given
table on the target db,
from the given incomingData of the source db. |
protected void |
updateTableUsingRemoteId(SynchroTableDao targetDao,
ResultSet incomingData,
SynchroResult result,
SynchroPendingOperationBuffer tableBuffer)
To update the content of the given
table on the target db,
from the given incomingData of the source db. |
getInterceptor, getInterceptors, reportProgress
public DataSynchroServiceImpl(DataSource dataSource, SynchroConfiguration config)
public DataSynchroServiceImpl()
public SynchroContext createSynchroContext(File sourceDbDirectory)
DataSynchroService
createSynchroContext
in interface DataSynchroService
sourceDbDirectory
- a directory with a HSQLDB directory.public SynchroContext createSynchroContext(Properties sourceConnectionProperties)
DataSynchroService
createSynchroContext
in interface DataSynchroService
sourceConnectionProperties
- Properties to use as source connection (could be Oracle, HSQLDB...)public void prepare(SynchroContext synchroContext)
DataSynchroService
prepare
in interface DataSynchroService
synchroContext
- Context of synchronizationpublic void synchronize(SynchroContext synchroContext)
DataSynchroService
synchronize
in interface DataSynchroService
synchroContext
- Context of synchronizationprotected void prepareRootTable(SynchroTableMetadata sourceTable, SynchroTableMetadata targetTable, Connection sourceConnection, Connection targetConnection, SynchroResult result) throws SQLException
SQLException
protected void synchronizeRootTable(SynchroTableMetadata table, SynchroContext context, Connection sourceConnection, Connection targetConnection, SynchroResult result, SynchroPendingOperationBuffer tableBuffer) throws SQLException
SQLException
protected void synchronizeChildTable(SynchroTableMetadata table, String joinColumnName, Set<Integer> joinColumnIds, Connection sourceConnection, Connection targetConnection, SynchroResult result, SynchroPendingOperationBuffer tableBuffer) throws SQLException
SQLException
protected void updateTableUsingRemoteId(SynchroTableDao targetDao, ResultSet incomingData, SynchroResult result, SynchroPendingOperationBuffer tableBuffer) throws SQLException
table
on the target db,
from the given incomingData
of the source db.
The algorithm use remote_id : for each row of the incomingData
, if exists on target table, then do an
update, otherwise do a insert.
synchroContext
- Synchronization contexttargetDao
- connection on the target dbincomingData
- data to update from the source dbresult
- where to store operation resultsSQLException
- if any sql errorsprotected void updateTableNoRemoteId(SynchroTableDao targetDao, ResultSet incomingData, SynchroResult result, SynchroPendingOperationBuffer tableBuffer) throws SQLException
table
on the target db,
from the given incomingData
of the source db.
The algorithm use a standard update strategy, using primary key.synchroContext
- targetDao
- incomingData
- result
- SQLException
protected Properties getRemoteProperties(File dbDirectory)
protected void synchronizeChildTables(SynchroTableMetadata parentTable, Set<Integer> parentRemoteIds, SynchroContext context, Connection sourceConnection, Connection targetConnection, SynchroResult result, boolean enableLogCount) throws SQLException
SQLException
Copyright © 2012–2014 IFREMER. All rights reserved.