package org.sonar.server.issue.index;
+import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import org.elasticsearch.action.update.UpdateRequest;
public List<UpdateRequest> normalize(IssueAuthorizationDto dto) {
Map<String, Object> update = new HashMap<String, Object>();
-// Preconditions.checkNotNull(dto.getProjectUuid(), "Project uuid is null");
+ Preconditions.checkNotNull(dto.getProjectUuid(), "Project uuid is null");
update.put(IssueAuthorizationField.PROJECT.field(), dto.getProjectUuid());
update.put(IssueAuthorizationField.USERS.field(), dto.getUsers());
import org.sonar.server.search.IndexField;
import org.sonar.server.search.Indexable;
-import java.lang.reflect.Field;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
+import java.util.*;
public class RuleNormalizer extends BaseNormalizer<RuleDto, RuleKey> {
public static final IndexDefinition LOG = new IndexDefinition("logs", "sonarLog");
// Only used for test
- public static IndexDefinition TEST = new IndexDefinition("test", "test");
+ static final IndexDefinition TEST = new IndexDefinition("test", "test");
public static IndexDefinition createFor(String indexName, String indexType) {
return new IndexDefinition(indexName, indexType);
package org.sonar.server.search.request;
-import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.action.ActionRequest;
import org.elasticsearch.action.ListenableActionFuture;
import org.elasticsearch.action.bulk.BulkRequestBuilder;
import org.elasticsearch.action.delete.DeleteRequest;
import org.elasticsearch.action.index.IndexRequest;
import org.elasticsearch.action.update.UpdateRequest;
-import org.elasticsearch.client.Client;
import org.elasticsearch.common.unit.TimeValue;
import org.sonar.core.profiling.Profiling;
import org.sonar.core.profiling.StopWatch;
+import org.sonar.server.search.SearchClient;
public class ProxyBulkRequestBuilder extends BulkRequestBuilder {
private final Profiling profiling;
- public ProxyBulkRequestBuilder(Client client, Profiling profiling) {
+ public ProxyBulkRequestBuilder(SearchClient client, Profiling profiling) {
super(client);
this.profiling = profiling;
}
@Override
- public BulkResponse get() throws ElasticsearchException {
+ public BulkResponse get() {
StopWatch fullProfile = profiling.start("bulk", Profiling.Level.FULL);
try {
return super.execute().actionGet();
}
@Override
- public BulkResponse get(TimeValue timeout) throws ElasticsearchException {
+ public BulkResponse get(TimeValue timeout) {
throw new IllegalStateException("Not yet implemented");
}
@Override
- public BulkResponse get(String timeout) throws ElasticsearchException {
+ public BulkResponse get(String timeout) {
throw new IllegalStateException("Not yet implemented");
}
throw new UnsupportedOperationException("execute() should not be called as it's used for asynchronous");
}
+ @Override
public String toString() {
StringBuilder message = new StringBuilder();
message.append("ES bulk request for ");
package org.sonar.server.search.request;
import org.apache.commons.lang.StringUtils;
-import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.action.ListenableActionFuture;
import org.elasticsearch.action.admin.cluster.health.ClusterHealthRequestBuilder;
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
-import org.elasticsearch.client.Client;
import org.elasticsearch.common.unit.TimeValue;
import org.sonar.core.profiling.Profiling;
import org.sonar.core.profiling.StopWatch;
+import org.sonar.server.search.SearchClient;
public class ProxyClusterHealthRequestBuilder extends ClusterHealthRequestBuilder {
private final Profiling profiling;
- public ProxyClusterHealthRequestBuilder(Client client, Profiling profiling) {
+ public ProxyClusterHealthRequestBuilder(SearchClient client, Profiling profiling) {
super(client.admin().cluster());
this.profiling = profiling;
}
@Override
- public ClusterHealthResponse get() throws ElasticsearchException {
+ public ClusterHealthResponse get() {
StopWatch fullProfile = profiling.start("cluster health", Profiling.Level.FULL);
try {
return super.execute().actionGet();
}
@Override
- public ClusterHealthResponse get(TimeValue timeout) throws ElasticsearchException {
+ public ClusterHealthResponse get(TimeValue timeout) {
throw new IllegalStateException("Not yet implemented");
}
@Override
- public ClusterHealthResponse get(String timeout) throws ElasticsearchException {
+ public ClusterHealthResponse get(String timeout) {
throw new IllegalStateException("Not yet implemented");
}
throw new UnsupportedOperationException("execute() should not be called as it's used for asynchronous");
}
+ @Override
public String toString() {
StringBuilder message = new StringBuilder();
message.append("ES cluster health request");
package org.sonar.server.search.request;
import org.apache.commons.lang.StringUtils;
-import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.action.ListenableActionFuture;
import org.elasticsearch.action.admin.cluster.state.ClusterStateRequestBuilder;
import org.elasticsearch.action.admin.cluster.state.ClusterStateResponse;
-import org.elasticsearch.client.Client;
import org.elasticsearch.common.unit.TimeValue;
import org.sonar.core.profiling.Profiling;
import org.sonar.core.profiling.StopWatch;
+import org.sonar.server.search.SearchClient;
public class ProxyClusterStateRequestBuilder extends ClusterStateRequestBuilder {
private final Profiling profiling;
- public ProxyClusterStateRequestBuilder(Client client, Profiling profiling) {
+ public ProxyClusterStateRequestBuilder(SearchClient client, Profiling profiling) {
super(client.admin().cluster());
this.profiling = profiling;
}
@Override
- public ClusterStateResponse get() throws ElasticsearchException {
+ public ClusterStateResponse get() {
StopWatch fullProfile = profiling.start("cluster state", Profiling.Level.FULL);
try {
return super.execute().actionGet();
}
@Override
- public ClusterStateResponse get(TimeValue timeout) throws ElasticsearchException {
+ public ClusterStateResponse get(TimeValue timeout) {
throw new IllegalStateException("Not yet implemented");
}
@Override
- public ClusterStateResponse get(String timeout) throws ElasticsearchException {
+ public ClusterStateResponse get(String timeout) {
throw new IllegalStateException("Not yet implemented");
}
throw new UnsupportedOperationException("execute() should not be called as it's used for asynchronous");
}
+ @Override
public String toString() {
StringBuilder message = new StringBuilder();
message.append("ES cluster state request");
package org.sonar.server.search.request;
import org.apache.commons.lang.StringUtils;
-import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.action.ListenableActionFuture;
import org.elasticsearch.action.admin.cluster.stats.ClusterStatsRequestBuilder;
import org.elasticsearch.action.admin.cluster.stats.ClusterStatsResponse;
-import org.elasticsearch.client.Client;
import org.elasticsearch.common.unit.TimeValue;
import org.sonar.core.profiling.Profiling;
import org.sonar.core.profiling.StopWatch;
+import org.sonar.server.search.SearchClient;
public class ProxyClusterStatsRequestBuilder extends ClusterStatsRequestBuilder {
private final Profiling profiling;
- public ProxyClusterStatsRequestBuilder(Client client, Profiling profiling) {
+ public ProxyClusterStatsRequestBuilder(SearchClient client, Profiling profiling) {
super(client.admin().cluster());
this.profiling = profiling;
}
@Override
- public ClusterStatsResponse get() throws ElasticsearchException {
+ public ClusterStatsResponse get() {
StopWatch fullProfile = profiling.start("cluster stats", Profiling.Level.FULL);
try {
return super.execute().actionGet();
}
@Override
- public ClusterStatsResponse get(TimeValue timeout) throws ElasticsearchException {
+ public ClusterStatsResponse get(TimeValue timeout) {
throw new IllegalStateException("Not yet implemented");
}
@Override
- public ClusterStatsResponse get(String timeout) throws ElasticsearchException {
+ public ClusterStatsResponse get(String timeout) {
throw new IllegalStateException("Not yet implemented");
}
throw new UnsupportedOperationException("execute() should not be called as it's used for asynchronous");
}
+ @Override
public String toString() {
StringBuilder message = new StringBuilder();
message.append("ES cluster stats request");
package org.sonar.server.search.request;
import org.apache.commons.lang.StringUtils;
-import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.action.ListenableActionFuture;
import org.elasticsearch.action.count.CountRequestBuilder;
import org.elasticsearch.action.count.CountResponse;
-import org.elasticsearch.client.Client;
import org.elasticsearch.common.unit.TimeValue;
import org.sonar.core.profiling.Profiling;
import org.sonar.core.profiling.StopWatch;
+import org.sonar.server.search.SearchClient;
public class ProxyCountRequestBuilder extends CountRequestBuilder {
private final Profiling profiling;
- public ProxyCountRequestBuilder(Client client, Profiling profiling) {
+ public ProxyCountRequestBuilder(SearchClient client, Profiling profiling) {
super(client);
this.profiling = profiling;
}
@Override
- public CountResponse get() throws ElasticsearchException {
+ public CountResponse get() {
StopWatch fullProfile = profiling.start("count", Profiling.Level.FULL);
try {
return super.execute().actionGet();
}
@Override
- public CountResponse get(TimeValue timeout) throws ElasticsearchException {
+ public CountResponse get(TimeValue timeout) {
throw new IllegalStateException("Not yet implemented");
}
@Override
- public CountResponse get(String timeout) throws ElasticsearchException {
+ public CountResponse get(String timeout) {
throw new IllegalStateException("Not yet implemented");
}
throw new UnsupportedOperationException("execute() should not be called as it's used for asynchronous");
}
+ @Override
public String toString() {
StringBuilder message = new StringBuilder();
message.append("ES count request");
package org.sonar.server.search.request;
-import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.action.ListenableActionFuture;
import org.elasticsearch.action.admin.indices.create.CreateIndexRequestBuilder;
import org.elasticsearch.action.admin.indices.create.CreateIndexResponse;
-import org.elasticsearch.client.Client;
import org.elasticsearch.common.unit.TimeValue;
import org.sonar.core.profiling.Profiling;
import org.sonar.core.profiling.StopWatch;
+import org.sonar.server.search.SearchClient;
public class ProxyCreateIndexRequestBuilder extends CreateIndexRequestBuilder {
private final Profiling profiling;
private final String index;
- public ProxyCreateIndexRequestBuilder(Client client, Profiling profiling, String index) {
+ public ProxyCreateIndexRequestBuilder(SearchClient client, Profiling profiling, String index) {
super(client.admin().indices(), index);
this.profiling = profiling;
this.index = index;
}
@Override
- public CreateIndexResponse get() throws ElasticsearchException {
+ public CreateIndexResponse get() {
StopWatch fullProfile = profiling.start("create index", Profiling.Level.FULL);
try {
return super.execute().actionGet();
}
@Override
- public CreateIndexResponse get(TimeValue timeout) throws ElasticsearchException {
+ public CreateIndexResponse get(TimeValue timeout) {
throw new IllegalStateException("Not yet implemented");
}
@Override
- public CreateIndexResponse get(String timeout) throws ElasticsearchException {
+ public CreateIndexResponse get(String timeout) {
throw new IllegalStateException("Not yet implemented");
}
throw new UnsupportedOperationException("execute() should not be called as it's used for asynchronous");
}
+ @Override
public String toString() {
return String.format("ES create index '%s'", index);
}
package org.sonar.server.search.request;
import org.apache.commons.lang.StringUtils;
-import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.action.ListenableActionFuture;
import org.elasticsearch.action.admin.indices.flush.FlushRequestBuilder;
import org.elasticsearch.action.admin.indices.flush.FlushResponse;
-import org.elasticsearch.client.Client;
import org.elasticsearch.common.unit.TimeValue;
import org.sonar.core.profiling.Profiling;
import org.sonar.core.profiling.StopWatch;
+import org.sonar.server.search.SearchClient;
public class ProxyFlushRequestBuilder extends FlushRequestBuilder {
private final Profiling profiling;
- public ProxyFlushRequestBuilder(Client client, Profiling profiling) {
+ public ProxyFlushRequestBuilder(SearchClient client, Profiling profiling) {
super(client.admin().indices());
this.profiling = profiling;
}
@Override
- public FlushResponse get() throws ElasticsearchException {
+ public FlushResponse get() {
StopWatch fullProfile = profiling.start("flush", Profiling.Level.FULL);
try {
return super.execute().actionGet();
}
@Override
- public FlushResponse get(TimeValue timeout) throws ElasticsearchException {
+ public FlushResponse get(TimeValue timeout) {
throw new IllegalStateException("Not yet implemented");
}
@Override
- public FlushResponse get(String timeout) throws ElasticsearchException {
+ public FlushResponse get(String timeout) {
throw new IllegalStateException("Not yet implemented");
}
throw new UnsupportedOperationException("execute() should not be called as it's used for asynchronous");
}
+ @Override
public String toString() {
StringBuilder message = new StringBuilder();
message.append("ES flush request");
package org.sonar.server.search.request;
-import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.action.ListenableActionFuture;
import org.elasticsearch.action.get.GetRequestBuilder;
import org.elasticsearch.action.get.GetResponse;
-import org.elasticsearch.client.Client;
import org.elasticsearch.common.unit.TimeValue;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.sonar.core.profiling.Profiling;
import org.sonar.core.profiling.StopWatch;
+import org.sonar.server.search.SearchClient;
public class ProxyGetRequestBuilder extends GetRequestBuilder {
- private static final Logger LOGGER = LoggerFactory.getLogger(ProxyGetRequestBuilder.class);
-
private final Profiling profiling;
- public ProxyGetRequestBuilder(Client client, Profiling profiling) {
+ public ProxyGetRequestBuilder(SearchClient client, Profiling profiling) {
super(client);
this.profiling = profiling;
}
}
@Override
- public GetResponse get(TimeValue timeout) throws ElasticsearchException {
+ public GetResponse get(TimeValue timeout) {
throw new IllegalStateException("Not yet implemented");
}
@Override
- public GetResponse get(String timeout) throws ElasticsearchException {
+ public GetResponse get(String timeout) {
throw new IllegalStateException("Not yet implemented");
}
throw new UnsupportedOperationException("execute() should not be called as it's used for asynchronous");
}
+ @Override
public String toString() {
StringBuilder message = new StringBuilder().append("ES get request");
message.append(String.format(" for key '%s'", request.id()));
package org.sonar.server.search.request;
import org.apache.commons.lang.StringUtils;
-import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.action.ListenableActionFuture;
import org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsRequestBuilder;
import org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsResponse;
-import org.elasticsearch.client.Client;
import org.elasticsearch.common.unit.TimeValue;
import org.sonar.core.profiling.Profiling;
import org.sonar.core.profiling.StopWatch;
+import org.sonar.server.search.SearchClient;
public class ProxyIndicesExistsRequestBuilder extends IndicesExistsRequestBuilder {
private final Profiling profiling;
- public ProxyIndicesExistsRequestBuilder(Client client, Profiling profiling, String... indices) {
+ public ProxyIndicesExistsRequestBuilder(SearchClient client, Profiling profiling, String... indices) {
super(client.admin().indices(), indices);
this.profiling = profiling;
}
@Override
- public IndicesExistsResponse get() throws ElasticsearchException {
+ public IndicesExistsResponse get() {
StopWatch fullProfile = profiling.start("indices exists", Profiling.Level.FULL);
try {
return super.execute().actionGet();
}
@Override
- public IndicesExistsResponse get(TimeValue timeout) throws ElasticsearchException {
+ public IndicesExistsResponse get(TimeValue timeout) {
throw new IllegalStateException("Not yet implemented");
}
@Override
- public IndicesExistsResponse get(String timeout) throws ElasticsearchException {
+ public IndicesExistsResponse get(String timeout) {
throw new IllegalStateException("Not yet implemented");
}
throw new UnsupportedOperationException("execute() should not be called as it's used for asynchronous");
}
+ @Override
public String toString() {
StringBuilder message = new StringBuilder();
message.append("ES indices exists request");
package org.sonar.server.search.request;
import org.apache.commons.lang.StringUtils;
-import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.action.ListenableActionFuture;
import org.elasticsearch.action.admin.indices.stats.IndicesStatsRequestBuilder;
import org.elasticsearch.action.admin.indices.stats.IndicesStatsResponse;
-import org.elasticsearch.client.Client;
import org.elasticsearch.common.unit.TimeValue;
import org.sonar.core.profiling.Profiling;
import org.sonar.core.profiling.StopWatch;
+import org.sonar.server.search.SearchClient;
public class ProxyIndicesStatsRequestBuilder extends IndicesStatsRequestBuilder {
private final Profiling profiling;
- public ProxyIndicesStatsRequestBuilder(Client client, Profiling profiling) {
+ public ProxyIndicesStatsRequestBuilder(SearchClient client, Profiling profiling) {
super(client.admin().indices());
this.profiling = profiling;
}
@Override
- public IndicesStatsResponse get() throws ElasticsearchException {
+ public IndicesStatsResponse get() {
StopWatch fullProfile = profiling.start("indices stats", Profiling.Level.FULL);
try {
return super.execute().actionGet();
}
@Override
- public IndicesStatsResponse get(TimeValue timeout) throws ElasticsearchException {
+ public IndicesStatsResponse get(TimeValue timeout) {
throw new IllegalStateException("Not yet implemented");
}
@Override
- public IndicesStatsResponse get(String timeout) throws ElasticsearchException {
+ public IndicesStatsResponse get(String timeout) {
throw new IllegalStateException("Not yet implemented");
}
throw new UnsupportedOperationException("execute() should not be called as it's used for asynchronous");
}
+ @Override
public String toString() {
StringBuilder message = new StringBuilder();
message.append("ES indices stats request");
package org.sonar.server.search.request;
-import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.action.ListenableActionFuture;
import org.elasticsearch.action.get.MultiGetRequest;
import org.elasticsearch.action.get.MultiGetRequestBuilder;
import org.elasticsearch.action.get.MultiGetResponse;
-import org.elasticsearch.client.Client;
import org.elasticsearch.common.unit.TimeValue;
import org.sonar.core.profiling.Profiling;
import org.sonar.core.profiling.StopWatch;
+import org.sonar.server.search.SearchClient;
public class ProxyMultiGetRequestBuilder extends MultiGetRequestBuilder {
private final Profiling profiling;
- public ProxyMultiGetRequestBuilder(Client client, Profiling profiling) {
+ public ProxyMultiGetRequestBuilder(SearchClient client, Profiling profiling) {
super(client);
this.profiling = profiling;
}
@Override
- public MultiGetResponse get() throws ElasticsearchException {
+ public MultiGetResponse get() {
StopWatch fullProfile = profiling.start("get", Profiling.Level.FULL);
try {
return super.execute().actionGet();
}
@Override
- public MultiGetResponse get(TimeValue timeout) throws ElasticsearchException {
+ public MultiGetResponse get(TimeValue timeout) {
throw new IllegalStateException("Not yet implemented");
}
@Override
- public MultiGetResponse get(String timeout) throws ElasticsearchException {
+ public MultiGetResponse get(String timeout) {
throw new IllegalStateException("Not yet implemented");
}
throw new UnsupportedOperationException("execute() should not be called as it's used for asynchronous");
}
+ @Override
public String toString() {
StringBuilder message = new StringBuilder();
message.append("ES multi get request");
package org.sonar.server.search.request;
import org.apache.commons.lang.StringUtils;
-import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.action.ListenableActionFuture;
import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsRequestBuilder;
import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsResponse;
-import org.elasticsearch.client.Client;
import org.elasticsearch.common.unit.TimeValue;
import org.sonar.core.profiling.Profiling;
import org.sonar.core.profiling.StopWatch;
+import org.sonar.server.search.SearchClient;
public class ProxyNodesStatsRequestBuilder extends NodesStatsRequestBuilder {
private final Profiling profiling;
- public ProxyNodesStatsRequestBuilder(Client client, Profiling profiling) {
+ public ProxyNodesStatsRequestBuilder(SearchClient client, Profiling profiling) {
super(client.admin().cluster());
this.profiling = profiling;
}
@Override
- public NodesStatsResponse get() throws ElasticsearchException {
+ public NodesStatsResponse get() {
StopWatch fullProfile = profiling.start("nodes stats", Profiling.Level.FULL);
try {
return super.execute().actionGet();
}
@Override
- public NodesStatsResponse get(TimeValue timeout) throws ElasticsearchException {
+ public NodesStatsResponse get(TimeValue timeout) {
throw new IllegalStateException("Not yet implemented");
}
@Override
- public NodesStatsResponse get(String timeout) throws ElasticsearchException {
+ public NodesStatsResponse get(String timeout) {
throw new IllegalStateException("Not yet implemented");
}
throw new UnsupportedOperationException("execute() should not be called as it's used for asynchronous");
}
+ @Override
public String toString() {
StringBuilder message = new StringBuilder();
message.append("ES nodes stats request");
package org.sonar.server.search.request;
import org.apache.commons.lang.StringUtils;
-import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.action.ListenableActionFuture;
import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequestBuilder;
import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse;
-import org.elasticsearch.client.Client;
import org.elasticsearch.common.unit.TimeValue;
import org.sonar.core.profiling.Profiling;
import org.sonar.core.profiling.StopWatch;
+import org.sonar.server.search.SearchClient;
public class ProxyPutMappingRequestBuilder extends PutMappingRequestBuilder {
private final Profiling profiling;
- public ProxyPutMappingRequestBuilder(Client client, Profiling profiling) {
+ public ProxyPutMappingRequestBuilder(SearchClient client, Profiling profiling) {
super(client.admin().indices());
this.profiling = profiling;
}
@Override
- public PutMappingResponse get() throws ElasticsearchException {
+ public PutMappingResponse get() {
StopWatch fullProfile = profiling.start("put mapping", Profiling.Level.FULL);
try {
return super.execute().actionGet();
}
@Override
- public PutMappingResponse get(TimeValue timeout) throws ElasticsearchException {
+ public PutMappingResponse get(TimeValue timeout) {
throw new IllegalStateException("Not yet implemented");
}
@Override
- public PutMappingResponse get(String timeout) throws ElasticsearchException {
+ public PutMappingResponse get(String timeout) {
throw new IllegalStateException("Not yet implemented");
}
throw new UnsupportedOperationException("execute() should not be called as it's used for asynchronous");
}
+ @Override
public String toString() {
StringBuilder message = new StringBuilder();
message.append("ES put mapping request");
package org.sonar.server.search.request;
import org.apache.commons.lang.StringUtils;
-import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.action.ListenableActionFuture;
import org.elasticsearch.action.admin.indices.refresh.RefreshRequestBuilder;
import org.elasticsearch.action.admin.indices.refresh.RefreshResponse;
-import org.elasticsearch.client.Client;
import org.elasticsearch.common.unit.TimeValue;
import org.sonar.core.profiling.Profiling;
import org.sonar.core.profiling.StopWatch;
+import org.sonar.server.search.SearchClient;
public class ProxyRefreshRequestBuilder extends RefreshRequestBuilder {
private final Profiling profiling;
- public ProxyRefreshRequestBuilder(Client client, Profiling profiling) {
+ public ProxyRefreshRequestBuilder(SearchClient client, Profiling profiling) {
super(client.admin().indices());
this.profiling = profiling;
}
@Override
- public RefreshResponse get() throws ElasticsearchException {
+ public RefreshResponse get() {
StopWatch fullProfile = profiling.start("refresh", Profiling.Level.FULL);
try {
return super.execute().actionGet();
}
@Override
- public RefreshResponse get(TimeValue timeout) throws ElasticsearchException {
+ public RefreshResponse get(TimeValue timeout) {
throw new IllegalStateException("Not yet implemented");
}
@Override
- public RefreshResponse get(String timeout) throws ElasticsearchException {
+ public RefreshResponse get(String timeout) {
throw new IllegalStateException("Not yet implemented");
}
throw new UnsupportedOperationException("execute() should not be called as it's used for asynchronous");
}
+ @Override
public String toString() {
StringBuilder message = new StringBuilder();
message.append("ES refresh request");
package org.sonar.server.search.request;
-import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.action.ListenableActionFuture;
import org.elasticsearch.action.search.SearchRequestBuilder;
import org.elasticsearch.action.search.SearchResponse;
-import org.elasticsearch.client.Client;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.common.xcontent.ToXContent;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentFactory;
import org.sonar.core.profiling.Profiling;
import org.sonar.core.profiling.StopWatch;
+import org.sonar.server.search.SearchClient;
import java.io.IOException;
import java.util.Arrays;
private final Profiling profiling;
- public ProxySearchRequestBuilder(Client client, Profiling profiling) {
+ public ProxySearchRequestBuilder(SearchClient client, Profiling profiling) {
super(client);
this.profiling = profiling;
}
@Override
- public SearchResponse get() throws ElasticsearchException {
+ public SearchResponse get() {
StopWatch fullProfile = profiling.start("search", Profiling.Level.FULL);
try {
return super.execute().actionGet();
}
@Override
- public SearchResponse get(TimeValue timeout) throws ElasticsearchException {
+ public SearchResponse get(TimeValue timeout) {
throw new IllegalStateException("Not yet implemented");
}
@Override
- public SearchResponse get(String timeout) throws ElasticsearchException {
+ public SearchResponse get(String timeout) {
throw new IllegalStateException("Not yet implemented");
}
throw new UnsupportedOperationException("execute() should not be called as it's used for asynchronous");
}
+ @Override
public String toString() {
StringBuilder message = new StringBuilder();
message.append(String.format("ES search request '%s'", xContentToString(super.internalBuilder())));
package org.sonar.server.search.request;
-import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.action.ListenableActionFuture;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.action.search.SearchScrollRequestBuilder;
-import org.elasticsearch.client.Client;
import org.elasticsearch.common.unit.TimeValue;
import org.sonar.core.profiling.Profiling;
import org.sonar.core.profiling.StopWatch;
+import org.sonar.server.search.SearchClient;
public class ProxySearchScrollRequestBuilder extends SearchScrollRequestBuilder {
private final Profiling profiling;
- public ProxySearchScrollRequestBuilder(String scrollId, Client client, Profiling profiling) {
+ public ProxySearchScrollRequestBuilder(String scrollId, SearchClient client, Profiling profiling) {
super(client, scrollId);
this.profiling = profiling;
}
@Override
- public SearchResponse get() throws ElasticsearchException {
+ public SearchResponse get() {
StopWatch fullProfile = profiling.start("search", Profiling.Level.FULL);
try {
return super.execute().actionGet();
}
@Override
- public SearchResponse get(TimeValue timeout) throws ElasticsearchException {
+ public SearchResponse get(TimeValue timeout) {
throw new IllegalStateException("Not yet implemented");
}
@Override
- public SearchResponse get(String timeout) throws ElasticsearchException {
+ public SearchResponse get(String timeout) {
throw new IllegalStateException("Not yet implemented");
}
throw new UnsupportedOperationException("execute() should not be called as it's used for asynchronous");
}
+ @Override
public String toString() {
return String.format("ES search scroll request for scroll id '%s'", super.request().scroll());
}
--- /dev/null
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+@ParametersAreNonnullByDefault
+package org.sonar.server.search.request;
+
+import javax.annotation.ParametersAreNonnullByDefault;