1   package com.trendmicro.grid.acl.ds.jpa;
2   
3   import com.trendmicro.grid.acl.ds.SourceDomainRepository;
4   import com.trendmicro.grid.acl.ds.datatypes.SharedSourceDomain;
5   import com.trendmicro.grid.acl.ds.jpa.entities.JpaSourceDomain;
6   import org.springframework.stereotype.Service;
7   
8   import javax.annotation.Resource;
9   
10  /**
11   * Is a service that fetches source domains.
12   *
13   * @author juergen_kellerer, 2010-06-01
14   * @version 1.0
15   */
16  @Service
17  public class JpaSourceDomainFetcher extends AbstractFetcher<String, JpaSourceDomain, SourceDomainRepository> {
18  
19  	@Resource
20  	JpaSourceDomainRepository fallbackDomainRepository;
21  
22  	public JpaSourceDomainFetcher() {
23  		super(SourceDomainRepository.class);
24  	}
25  
26  	@Override
27  	protected SourceDomainRepository getFallbackRepository() {
28  		return fallbackDomainRepository;
29  	}
30  
31  	@Override
32  	protected SharedSourceDomain fetch(SourceDomainRepository repository, String key) {
33  		return repository.getOrCreate(key);
34  	}
35  }