some renaming
This commit is contained in:
parent
9222fa3f59
commit
d32ad74402
|
@ -8,7 +8,7 @@ import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
|
|||
import ca.uhn.fhir.jpa.api.dao.IDao;
|
||||
import ca.uhn.fhir.jpa.batch.BatchJobsConfig;
|
||||
import ca.uhn.fhir.jpa.batch.api.IBatchJobSubmitter;
|
||||
import ca.uhn.fhir.jpa.batch.config.InMemoryJobRepositoryBatchConfig;
|
||||
import ca.uhn.fhir.jpa.batch.config.NonPersistedBatchConfigurer;
|
||||
import ca.uhn.fhir.jpa.batch.svc.BatchJobSubmitterImpl;
|
||||
import ca.uhn.fhir.jpa.binstore.BinaryAccessProvider;
|
||||
import ca.uhn.fhir.jpa.binstore.BinaryStorageInterceptor;
|
||||
|
@ -28,8 +28,8 @@ import ca.uhn.fhir.jpa.model.sched.ISchedulerService;
|
|||
import ca.uhn.fhir.jpa.packages.IHapiPackageCacheManager;
|
||||
import ca.uhn.fhir.jpa.packages.IPackageInstallerSvc;
|
||||
import ca.uhn.fhir.jpa.packages.JpaPackageCache;
|
||||
import ca.uhn.fhir.jpa.packages.PackageInstallerSvcImpl;
|
||||
import ca.uhn.fhir.jpa.packages.NpmJpaValidationSupport;
|
||||
import ca.uhn.fhir.jpa.packages.PackageInstallerSvcImpl;
|
||||
import ca.uhn.fhir.jpa.partition.IPartitionLookupSvc;
|
||||
import ca.uhn.fhir.jpa.partition.IRequestPartitionHelperSvc;
|
||||
import ca.uhn.fhir.jpa.partition.PartitionLookupSvcImpl;
|
||||
|
@ -63,6 +63,8 @@ import org.hibernate.jpa.HibernatePersistenceProvider;
|
|||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
import org.hl7.fhir.utilities.cache.FilesystemPackageCacheManager;
|
||||
import org.hl7.fhir.utilities.graphql.IGraphQLStorageServices;
|
||||
import org.springframework.batch.core.configuration.annotation.BatchConfigurer;
|
||||
import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
|
@ -119,8 +121,9 @@ import java.util.Date;
|
|||
@ComponentScan.Filter(type = FilterType.REGEX, pattern = "ca.uhn.fhir.jpa.batch.*")
|
||||
})
|
||||
@Import({
|
||||
SearchParamConfig.class, BatchJobsConfig.class, InMemoryJobRepositoryBatchConfig.class
|
||||
SearchParamConfig.class, BatchJobsConfig.class
|
||||
})
|
||||
@EnableBatchProcessing
|
||||
public abstract class BaseConfig {
|
||||
|
||||
public static final String JPA_VALIDATION_SUPPORT_CHAIN = "myJpaValidationSupportChain";
|
||||
|
@ -138,6 +141,11 @@ public abstract class BaseConfig {
|
|||
@Autowired
|
||||
private DaoRegistry myDaoRegistry;
|
||||
|
||||
@Bean
|
||||
public BatchConfigurer batchConfigurer() {
|
||||
return new NonPersistedBatchConfigurer();
|
||||
}
|
||||
|
||||
@Bean("myDaoRegistry")
|
||||
public DaoRegistry daoRegistry() {
|
||||
return new DaoRegistry();
|
||||
|
|
|
@ -21,7 +21,6 @@ package ca.uhn.fhir.jpa.batch.config;
|
|||
*/
|
||||
|
||||
import org.springframework.batch.core.configuration.annotation.BatchConfigurer;
|
||||
import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing;
|
||||
import org.springframework.batch.core.explore.JobExplorer;
|
||||
import org.springframework.batch.core.explore.support.MapJobExplorerFactoryBean;
|
||||
import org.springframework.batch.core.launch.JobLauncher;
|
||||
|
@ -30,11 +29,12 @@ import org.springframework.batch.core.repository.JobRepository;
|
|||
import org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean;
|
||||
import org.springframework.batch.support.transaction.ResourcelessTransactionManager;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
@EnableBatchProcessing
|
||||
@Component
|
||||
@Configuration
|
||||
public class InMemoryJobRepositoryBatchConfig implements BatchConfigurer {
|
||||
|
||||
|
@ -43,6 +43,7 @@ public class InMemoryJobRepositoryBatchConfig implements BatchConfigurer {
|
|||
private JobRepository myJobRepository;
|
||||
private JobExplorer myJobExplorer;
|
||||
|
||||
|
||||
@Override
|
||||
public PlatformTransactionManager getTransactionManager() {
|
||||
return myPlatformTransactionManager;
|
||||
|
|
|
@ -0,0 +1,60 @@
|
|||
package ca.uhn.fhir.jpa.batch.config;
|
||||
|
||||
/*-
|
||||
* #%L
|
||||
* HAPI FHIR JPA Server - Batch Task Processor
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2020 University Health Network
|
||||
* %%
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
import org.springframework.batch.core.configuration.annotation.DefaultBatchConfigurer;
|
||||
import org.springframework.batch.core.explore.JobExplorer;
|
||||
import org.springframework.batch.core.explore.support.MapJobExplorerFactoryBean;
|
||||
import org.springframework.batch.core.repository.JobRepository;
|
||||
import org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean;
|
||||
import org.springframework.batch.support.transaction.ResourcelessTransactionManager;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
|
||||
|
||||
public class NonPersistedBatchConfigurer extends DefaultBatchConfigurer {
|
||||
|
||||
private PlatformTransactionManager myPlatformTransactionManager;
|
||||
private MapJobRepositoryFactoryBean myJobRepositoryFactory;
|
||||
|
||||
@Override
|
||||
public PlatformTransactionManager getTransactionManager() {
|
||||
if (myPlatformTransactionManager == null) {
|
||||
myPlatformTransactionManager = new ResourcelessTransactionManager();
|
||||
}
|
||||
return myPlatformTransactionManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected JobRepository createJobRepository() throws Exception {
|
||||
MapJobRepositoryFactoryBean factory = new MapJobRepositoryFactoryBean();
|
||||
factory.setTransactionManager(this.getTransactionManager());
|
||||
factory.afterPropertiesSet();
|
||||
myJobRepositoryFactory = factory;
|
||||
return factory.getObject();
|
||||
}
|
||||
|
||||
@Override
|
||||
public JobExplorer createJobExplorer() throws Exception {
|
||||
MapJobExplorerFactoryBean jobExplorerFactoryBean = new MapJobExplorerFactoryBean(myJobRepositoryFactory);
|
||||
jobExplorerFactoryBean.afterPropertiesSet();
|
||||
return jobExplorerFactoryBean.getObject();
|
||||
}
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
package ca.uhn.fhir.jpa.batch;
|
||||
|
||||
import ca.uhn.fhir.jpa.batch.config.BatchJobConfig;
|
||||
import ca.uhn.fhir.jpa.batch.config.InMemoryJobRepositoryBatchConfig;
|
||||
import ca.uhn.fhir.jpa.batch.config.TestBatchConfig;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.slf4j.Logger;
|
||||
import org.springframework.batch.core.Job;
|
||||
|
@ -14,7 +14,7 @@ import org.springframework.transaction.PlatformTransactionManager;
|
|||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration(classes = {BatchJobConfig.class, InMemoryJobRepositoryBatchConfig.class})
|
||||
@ContextConfiguration(classes = {BatchJobConfig.class, TestBatchConfig.class})
|
||||
abstract public class BaseBatchR4Test {
|
||||
private static final Logger ourLog = getLogger(BaseBatchR4Test.class);
|
||||
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
package ca.uhn.fhir.jpa.batch.config;
|
||||
|
||||
import org.springframework.batch.core.configuration.annotation.BatchConfigurer;
|
||||
import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
@EnableBatchProcessing
|
||||
public class TestBatchConfig {
|
||||
@Bean
|
||||
public BatchConfigurer batchConfigurer() {
|
||||
return new NonPersistedBatchConfigurer();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue