All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.nhindirect.config.springconfig.BundleProcessorConfig Maven / Gradle / Ivy

There is a newer version: 8.0.5
Show newest version
package org.nhindirect.config.springconfig;

import org.apache.camel.CamelContext;
import org.apache.camel.ProducerTemplate;
import org.nhindirect.config.processor.BundleCacheUpdateProcessor;
import org.nhindirect.config.processor.BundleRefreshProcessor;
import org.nhindirect.config.processor.impl.DefaultBundleCacheUpdateProcessorImpl;
import org.nhindirect.config.processor.impl.DefaultBundleRefreshProcessorImpl;
import org.nhindirect.config.repository.TrustBundleAnchorRepository;
import org.nhindirect.config.repository.TrustBundleRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


@Configuration
public class BundleProcessorConfig
{
	@Autowired
	protected CamelContext camelContext;

	@Value("${direct.config.bundlerefresh.endpointuri:seda:refresh-start}")
	protected String refreshEndpoint;
	
	@Bean
	public BundleRefreshProcessor bundleRefreshProcessor(TrustBundleRepository trustBundleRepo, TrustBundleAnchorRepository bundleAnchorRepo)
	{
		final DefaultBundleRefreshProcessorImpl retVal = new DefaultBundleRefreshProcessorImpl();
		retVal.setRepositories(trustBundleRepo, bundleAnchorRepo);
		
		return retVal;
	}
	
	@Bean 
	public BundleCacheUpdateProcessor bundleCacheUpdateProcessor(BundleRefreshProcessor refreshProc, TrustBundleRepository trustBundleRepo)
	{
		DefaultBundleCacheUpdateProcessorImpl proc = new DefaultBundleCacheUpdateProcessorImpl();
		proc.setRefreshProcessor(refreshProc);
		proc.setRepository(trustBundleRepo);
		
		return proc;
	}

    @Bean
    public ProducerTemplate bundleRefresh() throws Exception 
    {
    	final ProducerTemplate template = camelContext.createProducerTemplate();
    	template.setDefaultEndpointUri(refreshEndpoint);
        return template;
    }
	
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy