Refactor project file structure - #941
Conversation
except for index-specific settings, which have always been treated separately and were already in the new fairdatapoint.index package
and rename database.rdf.repository.MetadataRepository to metadata.MetadataRdfRepository and same for corresponding MetadataRepositoryException to remove ambiguity with respect to database.mongo.repository.MetadataRepository
and adapt src/main/resources accordingly rename MigrationRunner to DevelopmentMigrationRunner to be consistent with RdfDevelopmentMigrationRunner rename MongoConfig to MongoDbMigrationConfig and rename RdfRepositoryMigrationConfig to TripleStoreMigrationConfig, for clarity and consistency
and rename RepositoryProperties classes to RdfRepositoryProperties for clarity
resource loader looks for resources relative to class path, so the file structure in java and resources must match
This reverts commit 55887b3. because it turns out we cannot easily move the other fixtures into the acceptance test package, so better to keep them both in one place...
- fix fully qualified reference to Metadata class in @PreAuthorize - use SpEL Type T() to ensure that the existence of the class is checked https://docs.spring.io/spring-framework/reference/core/expressions/language-ref/types.html
… files migration content should not change, obviously we need a new migration to update these values to the new package names
because it is not only related to migrations: although it does only define a mongock (migration) bean, it also configures mongodb itself via annotations
|
For reference, here's the explanation of type mapping using
|
…kage names simply by ignoring the old package names...
…ACL._class because these were altered in v1.17.3 but never migrated either
the ResourceReader is completely unrelated to the org.fairdatateam.fairdatapoint.resource package
…ed as embedded in Membership no mongodb collection is ever created for MembershipPermission, there is no corresponding Repository class
…webhook changes to migration 0021
…kages for consistency and cohesion
|
PR was approved by Luiz out-of-band |
The big shuffle
Converted the project file structure from the technology-based "folder-by-type" pattern (a.k.a. "package-by-layer") to a domain-based "folder-by-feature" pattern (a.k.a. "package-by-feature"). This makes the code more coherent, easier to navigate, and follows best-practices (see e.g. spring-boot docs).
This is a very large change in terms of file count and lines of code, but nearly all of the changes are simply due to changed package names and or class names, and corresponding changes in imports.
The
testfile structure now matches themainfile structure, except for theacceptancetests (these require thorough refactoring which will be tackled in a separate PR). This is more consistent and allows direct access to the classes from the corresponding main package, so we don't need to import those in the tests anymore.fixes #856
todo:
Add new data migration to fix modified class paths (
_classandACL.className) in mongo documents in existing deployments (_classis added by Spring Data MongoDB). Based on@Documentannotations, the following mongo collections need to be updated:Note that some of these collections are only created after some interaction has taken place, e.g.
eventonly appears if index functionality is enabled and a ping has been received, and the settings collections only appear after the corresponding settings have been changed. Same formembershipPermissionandsearchSavedQuery. Note that it looks like thewebhookcollection is never created at all (Can we remove the webhook repository? #969).-> (added migration 0021 to apply these changes)
Note that we should also consider possible leftover
nl.dtls.*package names in the_classfields, because earlier (v1.17.3 and v1.19.1) changes in fdp package names did not include a migration for_class... This has slipped through the cracks, probably because spring data mongodb uses a fallback if the_classvalue does not resolve. -> This was addressed in migration 0021 by simply overwriting any_classvalue if it does not match the desired value (this does not depend on the namespace of the original value).Test migration from latest release to this version to see if mongo migrations are still working properly -> Tested manually, starting from v1.16.2 (container), v1.17.3 (source), and from latest v1.22.0 (source). Verified that all
_classvalues andACL.classNamewere updated properly and that the fdp-client can interact with the fdp. Also verified that bothorg.fairdatateamandnl.dtlsnamespaces are updated properly.