001    package org.sonar.ide.wsclient;
002    
003    import java.util.Collection;
004    
005    import org.sonar.ide.api.SourceCode;
006    import org.sonar.ide.api.SourceCodeDiffEngine;
007    import org.sonar.ide.api.SourceCodeSearchEngine;
008    import org.sonar.wsclient.Host;
009    
010    /**
011     * @author Evgeny Mandrikov
012     * @since 0.2
013     */
014    public class RemoteSonar implements SourceCodeSearchEngine {
015    
016      private RemoteSonarIndex index;
017    
018      public RemoteSonar(Host host) {
019        this(host, new SimpleSourceCodeDiffEngine());
020      }
021    
022      public RemoteSonar(Host host, SourceCodeDiffEngine diffEngine) {
023        index = new RemoteSonarIndex(host, diffEngine);
024      }
025    
026      public SourceCode search(String key) {
027        return index.search(key);
028      }
029    
030      public Collection<SourceCode> getProjects() {
031        return index.getProjects();
032      }
033    
034    }