Projects >> atlas >>5e76d929c21f584d990422fbe77c31f285a5fbdc

Chunk
Conflicting content
    @Bean
@Import(EquivModule.class)
public class QueryModule {

<<<<<<< HEAD
    @Autowired
    @Qualifier("remoteSiteContentResolver")
    private CanonicalisingFetcher localOrRemoteFetcher;
    @Autowired
    private LookupEntryStore mongoStore;
    @Autowired
    private KnownTypeContentResolver mongoResolver;
    @Autowired
    @Qualifier(value = "cassandra")
    private ContentResolver cassandraResolver;
    @Autowired
    private TopicContentUriLister topicContentUriLister;
    @Autowired
    @Qualifier("contentUpdater")
    private EquivalenceUpdater equivUpdater;
    //
    @Value("${applications.enabled}")
    private String applicationsEnabled;

    @Bean
    public KnownTypeQueryExecutor queryExecutor() {

        KnownTypeQueryExecutor queryExecutor = new LookupResolvingQueryExecutor(new SimpleKnownTypeContentResolver(cassandraResolver),
                new FilterScheduleOnlyKnownTypeContentResolver(mongoResolver),
                mongoStore);

        queryExecutor = new UriFetchingQueryExecutor(localOrRemoteFetcher, queryExecutor, equivUpdater, ImmutableSet.of(FACEBOOK));

        queryExecutor = new CurieResolvingQueryExecutor(queryExecutor);

        queryExecutor = new MergeOnOutputQueryExecutor(queryExecutor);

        return Boolean.parseBoolean(applicationsEnabled) ? new ApplicationConfigurationQueryExecutor(queryExecutor) : queryExecutor;
    }

    public TopicContentLister mergingTopicContentLister() {
        KnownTypeContentResolver contentResolver = new FilterScheduleOnlyKnownTypeContentResolver(mongoResolver);
        final KnownTypeQueryExecutor queryExecutor = new MergeOnOutputQueryExecutor(
                new LookupResolvingQueryExecutor(new SimpleKnownTypeContentResolver(cassandraResolver), contentResolver, mongoStore));

        return new TopicContentLister() {

            @Override
            public Iterable contentForTopic(Long topicId, ContentQuery contentQuery) {
                Map> resolved = queryExecutor.executeUriQuery(urisFor(topicId, contentQuery), contentQuery);
                return Iterables.filter(Iterables.concat(resolved.values()), Content.class);
            }

            private Iterable urisFor(Long topicId, ContentQuery contentQuery) {
                return topicContentUriLister.contentUrisForTopic(topicId, contentQuery);
            }
        };

    }

=======
	private @Autowired @Qualifier("remoteSiteContentResolver") CanonicalisingFetcher localOrRemoteFetcher;
	
	private @Autowired DatabasedMongo mongo;
    private @Autowired CassandraContentStore cassandra;
    private @Autowired @Qualifier("contentUpdater") EquivalenceUpdater equivUpdater;
	
	private @Value("${applications.enabled}") String applicationsEnabled;
    private @Value("${atlas.search.host}") String searchHost;
    private @Value("${cassandra.enabled}") boolean cassandraEnbaled;

	@Bean KnownTypeQueryExecutor queryExecutor() {
	    
	    KnownTypeContentResolver mongoContentResolver = new FilterScheduleOnlyKnownTypeContentResolver(new MongoContentResolver(mongo));
        KnownTypeContentResolver cassandraContentResolver = new CassandraKnownTypeContentResolver(cassandra);
		
        KnownTypeQueryExecutor queryExecutor = new LookupResolvingQueryExecutor(cassandraContentResolver, mongoContentResolver, new MongoLookupEntryStore(mongo), cassandraEnbaled);
		
		queryExecutor = new UriFetchingQueryExecutor(localOrRemoteFetcher, queryExecutor, equivUpdater, ImmutableSet.of(FACEBOOK));
		
	    queryExecutor = new CurieResolvingQueryExecutor(queryExecutor);
		
	    queryExecutor = new MergeOnOutputQueryExecutor(queryExecutor);
	    
	    return Boolean.parseBoolean(applicationsEnabled) ? new ApplicationConfigurationQueryExecutor(queryExecutor) : queryExecutor;
	}
//	
//	@Bean @Lazy SearchResolver searchResolver() {
//	    System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" + applicationsEnabled);
//	    if (! Strings.isNullOrEmpty(searchHost)) {
//	        System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" + searchHost);
//    	    ContentSearcher titleSearcher = new RemoteFuzzySearcher(searchHost);
//    	    return new ContentResolvingSearcher(titleSearcher, queryExecutor());
//	    }
//	    
//	    return new DummySearcher();
//	}
>>>>>>> 32fdce050a1bbeed6073ac63af16fc4c0aca24b1
}
Solution content
@Import(EquivModule.class)
public class QueryModule {

    @Autowired
    @Qualifier("remoteSiteContentResolver")
    private CanonicalisingFetcher localOrRemoteFetcher;
    @Autowired
    private LookupEntryStore mongoStore;
    @Autowired
    private KnownTypeContentResolver mongoResolver;
    @Autowired
    @Qualifier(value = "cassandra")
    private ContentResolver cassandraResolver;
    @Autowired
    private TopicContentUriLister topicContentUriLister;
    @Autowired
    @Qualifier("contentUpdater")
    private EquivalenceUpdater equivUpdater;
    //
    @Value("${applications.enabled}")
    private String applicationsEnabled;
    private @Value("${cassandra.enabled}") boolean cassandraEnabled;

    @Bean
    public KnownTypeQueryExecutor queryExecutor() {

        KnownTypeQueryExecutor queryExecutor = new LookupResolvingQueryExecutor(new SimpleKnownTypeContentResolver(cassandraResolver),
                new FilterScheduleOnlyKnownTypeContentResolver(mongoResolver),
                mongoStore, cassandraEnabled);

        queryExecutor = new UriFetchingQueryExecutor(localOrRemoteFetcher, queryExecutor, equivUpdater, ImmutableSet.of(FACEBOOK));

        queryExecutor = new CurieResolvingQueryExecutor(queryExecutor);

        queryExecutor = new MergeOnOutputQueryExecutor(queryExecutor);

        return Boolean.parseBoolean(applicationsEnabled) ? new ApplicationConfigurationQueryExecutor(queryExecutor) : queryExecutor;
    }

    @Bean
    public TopicContentLister mergingTopicContentLister() {
        KnownTypeContentResolver contentResolver = new FilterScheduleOnlyKnownTypeContentResolver(mongoResolver);
        final KnownTypeQueryExecutor queryExecutor = new MergeOnOutputQueryExecutor(
                new LookupResolvingQueryExecutor(new SimpleKnownTypeContentResolver(cassandraResolver), contentResolver, mongoStore, cassandraEnabled));

        return new TopicContentLister() {

            @Override
            public Iterable contentForTopic(Long topicId, ContentQuery contentQuery) {
                Map> resolved = queryExecutor.executeUriQuery(urisFor(topicId, contentQuery), contentQuery);
                return Iterables.filter(Iterables.concat(resolved.values()), Content.class);
            }

            private Iterable urisFor(Long topicId, ContentQuery contentQuery) {
                return topicContentUriLister.contentUrisForTopic(topicId, contentQuery);
            }
        };

    }

}
File
QueryModule.java
Developer's decision
Manual
Kind of conflict
Annotation
Attribute
Comment
Method declaration
Chunk
Conflicting content
import com.google.common.collect.Maps;
import com.google.common.collect.Maps.EntryTransformer;
import com.google.common.collect.Sets;
<<<<<<< HEAD
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
=======
import com.metabroadcast.common.properties.Configurer;
>>>>>>> 32fdce050a1bbeed6073ac63af16fc4c0aca24b1

public class LookupResolvingQueryExecutor implements KnownTypeQueryExecutor {
Solution content
import com.google.common.collect.Maps;
import com.google.common.collect.Maps.EntryTransformer;
import com.google.common.collect.Sets;

public class LookupResolvingQueryExecutor implements KnownTypeQueryExecutor {
File
LookupResolvingQueryExecutor.java
Developer's decision
None
Kind of conflict
Import
Chunk
Conflicting content
    @Override
    public Map> executeUriQuery(Iterable uris, final ContentQuery query) {
<<<<<<< HEAD
        try {
            Map> results = resolveCassandraEntries(uris, query);
            if (results.size() < Iterables.size(uris)) {
                results = Maps.newHashMap(results);
                results.putAll(resolveMongoEntries(query, mongoLookupResolver.entriesForCanonicalUris(Sets.difference(Sets.newHashSet(uris), results.keySet()))));
=======
        Map> results = resolveMongoEntries(query, mongoLookupResolver.entriesForIdentifiers(uris, true));
        if (cassandraEnabled && results.isEmpty()) {
            try {
                results = resolveCassandraEntries(uris, query);
            }
            catch(Exception e) {
                log.error(String.format("Cassandra resolution failed for URIS %s", uris), e);
>>>>>>> 32fdce050a1bbeed6073ac63af16fc4c0aca24b1
            }
            return results;
        } catch (RuntimeException ex) {
Solution content
    @Override
    public Map> executeUriQuery(Iterable uris, final ContentQuery query) {
        try {
            Map> results = resolveCassandraEntries(uris, query);
            if (cassandraEnabled && results.size() < Iterables.size(uris)) {
                results = Maps.newHashMap(results);
                results.putAll(resolveMongoEntries(query, mongoLookupResolver.entriesForCanonicalUris(Sets.difference(Sets.newHashSet(uris), results.keySet()))));
            }
            return results;
        } catch (RuntimeException ex) {
File
LookupResolvingQueryExecutor.java
Developer's decision
Manual
Kind of conflict
Catch clause
If statement
Method invocation
Try statement
Variable
Chunk
Conflicting content
@Import({HuluAdapterModule.class, ArchiveOrgAdapterModule.class, FacebookAdapterModule.class, YouTubeAdapterModule.class})
public class RemoteSiteModule {

<<<<<<< HEAD
    @Autowired
    private AdapterLog log;
    @Autowired
    private Collection> remoteAdapters;
    //
    //private @Autowired YouTubeAdapterModule youTubeAdapterModule;

    @Bean
    public Fetcher remoteFetcher() {

        PerSiteAdapterDispatcher dispatcher = new PerSiteAdapterDispatcher(log);

        List> adapters = Lists.newArrayList();

        adapters.addAll(remoteAdapters);

        adapters.add(new TedTalkAdapter());
        adapters.add(new DailyMotionItemAdapter());
        adapters.add(new BlipTvAdapter());

        adapters.add(new VimeoAdapter());

        OembedXmlAdapter flickrAdapter = new OembedXmlAdapter();
        flickrAdapter.setAcceptedUriPattern("http://www.flickr.com/photos/[^/]+/[\\d]+");
        flickrAdapter.setOembedEndpoint("http://www.flickr.com/services/oembed/");
        flickrAdapter.setPublisher(Publisher.FLICKR);

        adapters.add(flickrAdapter);

        dispatcher.setAdapters(adapters);
        return dispatcher;
    }
=======
	private @Autowired AdapterLog log;
	
	private @Autowired Collection> remoteAdapters;
	private @Autowired YouTubeAdapterModule youTubeAdapterModule;

	public @Bean Fetcher remoteFetcher() {
		
		 PerSiteAdapterDispatcher dispatcher = new PerSiteAdapterDispatcher(log);
		 
		 List> adapters = Lists.newArrayList();
		 
		 adapters.addAll(remoteAdapters);
		 
		 adapters.add(new TedTalkAdapter());
		 adapters.add(new DailyMotionItemAdapter());
		 adapters.add(new BlipTvAdapter());
         adapters.add(youTubeAdapterModule.youTubeAdapter());

		 
		 adapters.add(new VimeoAdapter());
		 
		 OembedXmlAdapter flickrAdapter = new OembedXmlAdapter();
		 flickrAdapter.setAcceptedUriPattern("http://www.flickr.com/photos/[^/]+/[\\d]+");
		 flickrAdapter.setOembedEndpoint("http://www.flickr.com/services/oembed/");
		 flickrAdapter.setPublisher(Publisher.FLICKR);
		 
		 adapters.add(flickrAdapter);
		 
		 dispatcher.setAdapters(adapters);
		 return dispatcher;
	}
>>>>>>> 32fdce050a1bbeed6073ac63af16fc4c0aca24b1
}
Solution content
    @Autowired
@Import({HuluAdapterModule.class, ArchiveOrgAdapterModule.class, FacebookAdapterModule.class, YouTubeAdapterModule.class})
public class RemoteSiteModule {

    @Autowired
    private AdapterLog log;
    private Collection> remoteAdapters;
    private @Autowired YouTubeAdapterModule youTubeAdapterModule;

    @Bean
    public Fetcher remoteFetcher() {

        PerSiteAdapterDispatcher dispatcher = new PerSiteAdapterDispatcher(log);

        List> adapters = Lists.newArrayList();

        adapters.addAll(remoteAdapters);

        adapters.add(new TedTalkAdapter());
        adapters.add(new DailyMotionItemAdapter());
        adapters.add(new BlipTvAdapter());
        adapters.add(youTubeAdapterModule.youTubeAdapter());

        adapters.add(new VimeoAdapter());

        OembedXmlAdapter flickrAdapter = new OembedXmlAdapter();
        flickrAdapter.setAcceptedUriPattern("http://www.flickr.com/photos/[^/]+/[\\d]+");
        flickrAdapter.setOembedEndpoint("http://www.flickr.com/services/oembed/");
        flickrAdapter.setPublisher(Publisher.FLICKR);

        adapters.add(flickrAdapter);

        dispatcher.setAdapters(adapters);
        return dispatcher;
    }

}
File
RemoteSiteModule.java
Developer's decision
Combination
Kind of conflict
Annotation
Attribute
Comment
Method declaration
Chunk
Conflicting content
    
    private LookupResolvingQueryExecutor executor;

<<<<<<< HEAD
    @Ignore("Doesn't currently work as equivalence isn't implemented yet in Cassandra.")
    public void setsSameAs() {
=======
    @Before
    public void setup(){
        executor = new LookupResolvingQueryExecutor(cassandraContentResolver, mongoContentResolver, lookupStore, true);

    }
    @Test
    public void testSetsSameAs() {
>>>>>>> 32fdce050a1bbeed6073ac63af16fc4c0aca24b1
        final String query = "query";
        final Item queryItem = new Item(query, "qcurie", Publisher.BBC);
        final Item equivItem = new Item("equiv", "ecurie", Publisher.YOUTUBE);
Solution content
    
    private LookupResolvingQueryExecutor executor;

    @Before
    public void setup(){
        executor = new LookupResolvingQueryExecutor(cassandraContentResolver, mongoContentResolver, lookupStore, true);

    }

    @Test
    @Ignore("Doesn't currently work as equivalence isn't implemented yet in Cassandra.")
    public void setsSameAs() {
        final String query = "query";
        final Item queryItem = new Item(query, "qcurie", Publisher.BBC);
        final Item equivItem = new Item("equiv", "ecurie", Publisher.YOUTUBE);
File
LookupResolvingQueryExecutorTest.java
Developer's decision
Combination
Kind of conflict
Annotation
Method declaration
Method signature