MOD-DATA-EXPORT migration process to Spring - documentation

Steps required for migration

General: 

Replace io.vertx.core.json.JsonObject and io.vertx.core.json.JsonArray with another classes (for example, https://github.com/stleary/JSON-java, or https://github.com/google/gson) 

(at the grooming session it was decided not to use Json, but DTO)


Replace constants from org.folio.rest.RestVerticle.* (domain-models-runtime library) with constants from another class (or create such constants) 

Create data-export.yaml 

Create required spring controllers 

Remove ramls package 

Create system user permissions if needed (at the grooming session it was decided that system user is not needed because Kafka will not be used in the project)

Create DTO

 

org.folio.service.export: 

Remove io.vertx.core.Future or replace with java.util.concurrent.Future from the org.folio.service.export.storage.ExportStorageService interface. 

org.folio.service.file: 

Remove io.vertx.core.Future or replace with java.util.concurrent.Future from the org.folio.service.file.cleanup.StorageCleanupService interface. 

Remove io.vertx.core.Future or replace with java.util.concurrent.Future from the org.folio.service.file.definition.FileDefinitionService interface. 

Remove io.vertx.core.Future or replace with java.util.concurrent.Future from the org.folio.service.file.storage.FileStorage interface. 

Remove io.vertx.core.Future or replace with java.util.concurrent.Future from the org.folio.service.file.upload.FileUploadService interface. 

org.folio.service.job: 

Remove io.vertx.core.Future or replace with java.util.concurrent.Future from the org.folio.service.job.JobExecutionService interface. 

org.folio.service.logs: 

Remove io.vertx.core.Future or replace with java.util.concurrent.Future from the org.folio.service.logs.ErrorLogService interface. 

org.folio.service.manager.export: 

Change org.folio.service.manager.export.strategy.ExportStrategy interface and remove blockingPromise parameter from the method. 

Remove create and createProxy methods, as well as EXPORT_MANAGER_ADDRESS field from the org.folio.service.manager.export.ExportManager interface 

Remove @DataObject annotation from org.folio.service.manager.export.ExportResult class 

Remove org.folio.service.manager.export.package-info.java 

org.folio.service.manager.input: 

Remove io.vertx.core.shareddata.Shareable interface implementation from the org.folio.service.manager.input.InputDataContext class 

Remove @ProxyGen annotation from the org.folio.service.manager.input.InputDataManager interface 

Remove create and createProxy methods, as well as INPUT_DATA_MANAGER_ADDRESS field from the  org.folio.service.manager.input.InputDataManager interface 

Remove org.folio.service.manager.input.package-info.java 

org.folio.service.profiles: 

Remove io.vertx.core.Future or replace with java.util.concurrent.Future from the org.folio.service.profiles.jobprofile.JobProfileService interface 

Remove io.vertx.core.Future or replace with java.util.concurrent.Future from the org.folio.service.profiles.mappingprofile.MappingProfileService interface 

org.folio.service.transformationfields: 

Remove io.vertx.core.Future or replace with java.util.concurrent.Future from the org.folio.service.transformationfields.TransformationFieldsService interface. 

 

org.folio.util: 

Modify org.folio.util.ExceptionToResponseMapper by replacing ValidationHelper#handleError method from the domain-models-runtime library with another appropriate method. 

 

org.folio.rest: 

Remove org.folio.rest.impl.InitAPIImpl class

Remove io.vertx.core.Future or replace with java.util.concurrent.Future from the org.folio.rest.impl.DataExportHelper class. 

Modify org.folio.rest.impl.DataExportImpl class and remove io.vertx.core.* from the methods (effort is required) 

Modify org.folio.rest.impl.DataExportImplFileDefinitionImpl class and remove io.vertx.core.* from the methods (effort is required) 

Modify org.folio.rest.impl.DataExportImplJobProfileImpl class and remove io.vertx.core.* from the methods (effort is required) 

Modify org.folio.rest.impl.DataExportImplLogsImpl class and remove io.vertx.core.* from the methods (effort is required) 

Modify org.folio.rest.impl.DataExportImplMappingProfilesImpl class and remove io.vertx.core.* from the methods (effort is required) 

Modify org.folio.rest.impl.DataExportImplTransformationFieldsImpl class and remove io.vertx.core.* from the methods (effort is required) 

 

org.folio.dao: 

Replace org.folio.rest.persist.PostgresClient from domain-models-runtime library with the client from the https://github.com/folio-org/folio-spring-base and make appropriate changes to the classes in the org.folio.dao.impl package; create appropriate JPA repositories 

 (a lot of effort is required) 

Remove io.vertx.core.Future or replace with java.util.concurrent.Future from the org.folio.dao.ErrorLogDao interface. 

Remove io.vertx.core.Future or replace with java.util.concurrent.Future from the org.folio.dao.FileDefinitionDao interface. 

Remove io.vertx.core.Future or replace with java.util.concurrent.Future from the org.folio.dao.JobExecutionDao interface. 

Remove io.vertx.core.Future or replace with java.util.concurrent.Future from the org.folio.dao.JobProfileDao interface. 

Remove io.vertx.core.Future or replace with java.util.concurrent.Future from the org.folio.dao.MappingProfileDao interface. 

 

org.folio.config: 

Modify org.folio.config.ApplicationConfig#getWebClient method and replace a web client based on the Vert.x library with another one. 

 

org.folio.clients: 

Remove io.vertx.core.Future or replace with java.util.concurrent.Future from the org.folio.clients.ClientUtilAsync class and modify getRequest method. 

Remove io.vertx.core.json.* from the org.folio.clients.ConfigurationsClient class, modify methods (effort is required) (remove org.folio.rest.persist.Criteria.Criterion from the domain-models-runtime library) 

Remove Vert.x library from the org.folio.clients.InventoryClient and replace a web client based on the Vert.x library with another one 

Remove io.vertx.core.Future or replace with java.util.concurrent.Future from the org.folio.clients.UsersClient class and modify getUserInfoAsync method. 

 

pom.xml: 

Remove all Vert.x dependencies and domain-models-runtime library 

 

tests: 

Make appropriate changes to tests (effort is required) 

 

Affected area

org.folio.service.export, org.folio.service.file, org.folio.service.job, org.folio.service.logs, org.folio.service.manager.export, org.folio.service.manager.input, org.folio.service.profiles, org.folio.service.profiles, org.folio.service.transformationfields, org.folio.util, org.folio.rest, org.folio.dao, org.folio.config, org.folio.clients packages;  

pom.xml, tests;  

other possible files needed to be changed during migration 

 

Migration risks and possible mitigation

Risk: asynchronous calls  

Mitigation: usage of @Async annotation in Spring all asynchronous calls should be removed from the project; use existing internal Spring mechanisms to handle such calls

 

Risk: removing proxy services based on the Vert.x library 

Mitigation: usage of Spring based proxy services (for example, Zuul Proxy) if needed 

 

Risk: possible issues in case of changing the structure of the project based on the Spring 

Mitigation: remove only Vert.x and domain-models-runtime libraries, do not restructure the whole project at the grooming session we decided that migration to Spring has mostly long-term perspective and simplification of the code along with the increasing the readability is more preferable than the simplification of migration on its own


Risk: removing domain-models-runtime library might require an additional effort to change existing Postgres client, Tenant tool and RAMLs

Mitigation: use folio-spring-base library, create JPA repositories, use Swagger API


*at the grooming session we decided not to use Future approach at all, but to prove that, this story needs to be completed