Skip to content

feat(licensedb): Add conflict resolution module for data synchronization#3911

Open
ADITYA-CODE-SOURCE wants to merge 18 commits intoeclipse-sw360:mainfrom
ADITYA-CODE-SOURCE:licensedb/conflict-resolution
Open

feat(licensedb): Add conflict resolution module for data synchronization#3911
ADITYA-CODE-SOURCE wants to merge 18 commits intoeclipse-sw360:mainfrom
ADITYA-CODE-SOURCE:licensedb/conflict-resolution

Conversation

@ADITYA-CODE-SOURCE
Copy link
Contributor

Summary

Add conflict resolution module for LicenseDB data synchronization as part of GSoC 2026 project. This module handles conflicts that may arise when synchronizing license and obligation data from LicenseDB.

Changes

File Description
ResolutionStrategy.java Enum: REPLACE, SKIP, MERGE, MANUAL
ConflictResult.java Result container for resolution decisions
ConflictConfig.java Configuration properties for default strategies
ConflictResolver.java Interface for conflict resolution
LicenseConflictResolver.java License-specific conflict resolution
ObligationConflictResolver.java Obligation-specific conflict resolution

Resolution Strategies

Strategy Description
REPLACE Overwrite local data with LicenseDB data
SKIP Keep local data, ignore LicenseDB updates
MERGE Combine data (prefer non-null values)
MANUAL Flag for manual administrator review

Configuration

licensedb:
  conflict-resolution:
    default-license-strategy: REPLACE
    default-obligation-strategy: REPLACE
    audit-enabled: true
    audit-log-path: logs/license-db-conflicts.log

Usage

@Autowired
private LicenseConflictResolver licenseConflictResolver;

public void syncLicense(License incoming) {
    License existing = licenseService.getLicenseByShortname(incoming.getShortname());
    ConflictResult<License> result = licenseConflictResolver.resolve(
        incoming, 
        existing, 
        ResolutionStrategy.REPLACE
    );
    
    if (result.isRequiresManualReview()) {
        // Queue for manual review
    }
}

Testing

  • Files compile without errors
  • Follows SW360 code style
  • EPL-2.0 license headers included
  • No new dependencies

Dependencies

Related

Fixes #3899

Part of: GSoC 2026: Integration of SW360 and LicenseDB

- Add 10 LicenseDB configuration constants to SW360Constants.java
- Update sw360.properties in 3 locations
- Add LicenseDBConstantsTest.java with unit tests
- Fix CI: Configure CouchDB for single-node operation

This is Phase 1 of LicenseDB integration for GSoC 2026.

Signed-off-by: ADITYA-CODE-SOURCE <[email protected]>
- Add LICENSEDB to ConfigFor enum in sw360.thrift
- Add LICENSEDB_ID constant to SW360Constants
- Add LicenseDBConfig.java: OAuth and connection configuration
- Add LicenseDBRestClient.java: OAuth2 client credentials flow
- Add LicenseDBService.java: License and obligation sync logic
- Add LicenseDBController.java: Admin REST endpoints

This implements the core OAuth/M2M integration with LicenseDB.

Signed-off-by: ADITYA-CODE-SOURCE <[email protected]>
- Use constructor injection instead of RestTemplateBuilder
- Fix property prefix to match sw360.properties
- Use Spring's auto-configured RestTemplate bean

Signed-off-by: ADITYA-CODE-SOURCE <[email protected]>
- Add COUCHDB_CLUSTER_SIZE=1 to ensure single-node mode
- Add health check for CouchDB container
- Use -s flag for curl to suppress error output
- Add quotes around values for JSON compatibility
- Add || true to prevent step failure on errors

Signed-off-by: Aditya Vishe <[email protected]>
- Add LicenseDbClient.java
- Add LicenseDBProperties.java
- Add LicenseDbService.java

Signed-off-by: ADITYA-CODE-SOURCE <[email protected]>
…hen disabled

- Add @ConditionalOnProperty to LicenseDBRestClient
- Add @ConditionalOnProperty to LicenseDBService
- Add @ConditionalOnProperty to LicenseDBController
- This prevents Spring from trying to create these beans when licensedb.enabled=false
- Fixes 'No qualifying bean of type RestTemplate' error in tests
…eSpecTest and ObligationSpecTest

- Add new optional fields from thrift to REST Docs responseFields
- These fields are optional in the License/Obligation thrift structs
… tests

Thrift generates setXxx boolean fields for optional fields.
Changed from subsectionWithPath(licenseDbId) to fieldWithPath(setLicenseDbId) etc.
- Add ResolutionStrategy enum (REPLACE, SKIP, MERGE, MANUAL)
- Add ConflictResult class for resolution results
- Add ConflictConfig for configuration properties
- Add ConflictResolver interface
- Add LicenseConflictResolver for license conflict resolution
- Add ObligationConflictResolver for obligation conflict resolution

Implements: eclipse-sw360#3899
Part of: GSoC 2026 LicenseDB Integration
- Add creation of sw360_test_db, sw360changelogs, sw360spdx, sw360_test_attachments
- Fixes CouchDB 'no such file or directory' error during tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(licensedb): Add conflict resolution module for data synchronization

1 participant