use of uk.nhs.digital.apispecs.jcr.ApiSpecificationImportImportMetadataJcrRepository in project hippo by NHS-digital-website.
the class ApiSpecSyncFromApigeeJob method execute.
// @formatter:on
@Override
public void execute(final RepositoryJobExecutionContext context) {
log.debug("API Specifications sync from Apigee: start.");
Session session = null;
try {
final String apigeeAllSpecUrl = requireParameter(APIGEE_ALL_SPEC_URL, System.getProperty(APIGEE_ALL_SPEC_URL));
final String apigeeSingleSpecUrl = requireParameter(APIGEE_SINGLE_SPEC_URL, System.getProperty(APIGEE_SINGLE_SPEC_URL));
final ResourceServiceBroker resourceServiceBroker = resourceServiceBroker();
final ApigeeService apigeeService = new ApigeeService(resourceServiceBroker, apigeeAllSpecUrl, apigeeSingleSpecUrl);
session = context.createSystemSession();
final ApiSpecificationPublicationService apiSpecificationPublicationService = new ApiSpecificationPublicationService(apigeeService, new ApiSpecificationDocumentJcrRepository(session), new ApiSpecificationImportImportMetadataJcrRepository(session));
apiSpecificationPublicationService.syncEligibleSpecifications();
log.debug("API Specifications sync from Apigee: done.");
} catch (final Exception ex) {
log.error("Failed to sync specifications from Apigee.", ex);
} finally {
Optional.ofNullable(session).ifPresent(Session::logout);
}
}
Aggregations