/*
 * Copyright 2017 Crown Copyright
 *
 * 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.
 */

package stroom.search.impl;

import stroom.event.logging.rs.api.AutoLogged;
import stroom.event.logging.rs.api.AutoLogged.OperationType;

import com.codahale.metrics.annotation.Timed;

import javax.inject.Inject;
import javax.ws.rs.core.StreamingOutput;

@AutoLogged(OperationType.UNLOGGED)
public class RemoteSearchResourceImpl implements RemoteSearchResource {

    private final RemoteSearchService remoteSearchService;

    @Inject
    public RemoteSearchResourceImpl(final RemoteSearchService remoteSearchService) {
        this.remoteSearchService = remoteSearchService;
    }

    @Timed
    @Override
    public Boolean start(final ClusterSearchTask clusterSearchTask) {
        return remoteSearchService.start(clusterSearchTask);
    }

    @Timed
    @Override
    public StreamingOutput poll(final String queryKey) {
        return outputStream -> remoteSearchService.poll(queryKey, outputStream);
    }

    @Timed
    @Override
    public Boolean destroy(final String queryKey) {
        return remoteSearchService.destroy(queryKey);
    }
}

@@ -806,16 +806,46 @@
 Inject;%0A
+import javax.inject.Provider;%0A
 import j
@@ -1001,24 +1001,33 @@
 ivate final 
+Provider%3C
 RemoteSearch
@@ -1025,32 +1025,33 @@
 oteSearchService
+%3E
  remoteSearchSer
@@ -1054,16 +1054,24 @@
 hService
+Provider
 ;%0A%0A    @
@@ -1119,16 +1119,25 @@
 l(final 
+Provider%3C
 RemoteSe
@@ -1147,16 +1147,17 @@
 hService
+%3E
  remoteS
@@ -1168,16 +1168,24 @@
 hService
+Provider
 ) %7B%0A    
@@ -1212,16 +1212,24 @@
 hService
+Provider
  = remot
@@ -1242,16 +1242,24 @@
 hService
+Provider
 ;%0A    %7D%0A
@@ -1388,16 +1388,30 @@
 hService
+Provider.get()
 .start(c
@@ -1568,16 +1568,30 @@
 hService
+Provider.get()
 .poll(qu
@@ -1731,16 +1731,30 @@
 hService
+Provider.get()
 .destroy

Apply REST standards to RemoteSearchResourceImpl