rename Actions to ValidateActions

This commit is contained in:
Shay Banon 2012-01-15 12:09:18 +02:00
parent 864c2ac96d
commit 6ff15b928c
32 changed files with 42 additions and 60 deletions

View File

@ -22,7 +22,7 @@ package org.elasticsearch.action;
/**
*
*/
public class Actions {
public class ValidateActions {
public static ActionRequestValidationException addValidationError(String error, ActionRequestValidationException validationException) {
if (validationException == null) {

View File

@ -33,7 +33,7 @@ import org.elasticsearch.common.xcontent.XContentType;
import java.io.IOException;
import java.util.Map;
import static org.elasticsearch.action.Actions.addValidationError;
import static org.elasticsearch.action.ValidateActions.addValidationError;
import static org.elasticsearch.common.settings.ImmutableSettings.Builder.EMPTY_SETTINGS;
import static org.elasticsearch.common.settings.ImmutableSettings.readSettingsFromStream;
import static org.elasticsearch.common.settings.ImmutableSettings.writeSettingsToStream;

View File

@ -37,14 +37,12 @@ import java.io.IOException;
import java.util.List;
import java.util.Map;
import static org.elasticsearch.action.Actions.addValidationError;
import static org.elasticsearch.action.ValidateActions.addValidationError;
import static org.elasticsearch.cluster.metadata.AliasAction.readAliasAction;
import static org.elasticsearch.common.unit.TimeValue.readTimeValue;
/**
* A request to add/remove aliases for one or more indices.
*
*
*/
public class IndicesAliasesRequest extends MasterNodeOperationRequest {

View File

@ -27,7 +27,7 @@ import org.elasticsearch.common.io.stream.StreamOutput;
import java.io.IOException;
import static org.elasticsearch.action.Actions.addValidationError;
import static org.elasticsearch.action.ValidateActions.addValidationError;
/**
* A request to analyze a text associated with a specific index. Allow to provide

View File

@ -27,14 +27,12 @@ import org.elasticsearch.common.unit.TimeValue;
import java.io.IOException;
import static org.elasticsearch.action.Actions.addValidationError;
import static org.elasticsearch.action.ValidateActions.addValidationError;
import static org.elasticsearch.common.unit.TimeValue.readTimeValue;
import static org.elasticsearch.common.unit.TimeValue.timeValueSeconds;
/**
* A request to close an index.
*
*
*/
public class CloseIndexRequest extends MasterNodeOperationRequest {

View File

@ -38,7 +38,7 @@ import java.util.Map;
import java.util.concurrent.TimeUnit;
import static com.google.common.collect.Maps.newHashMap;
import static org.elasticsearch.action.Actions.addValidationError;
import static org.elasticsearch.action.ValidateActions.addValidationError;
import static org.elasticsearch.common.settings.ImmutableSettings.Builder.EMPTY_SETTINGS;
import static org.elasticsearch.common.settings.ImmutableSettings.readSettingsFromStream;
import static org.elasticsearch.common.settings.ImmutableSettings.writeSettingsToStream;
@ -49,7 +49,6 @@ import static org.elasticsearch.common.unit.TimeValue.readTimeValue;
* <p/>
* <p>The index created can optionally be created with {@link #settings(org.elasticsearch.common.settings.Settings)}.
*
*
* @see org.elasticsearch.client.IndicesAdminClient#create(CreateIndexRequest)
* @see org.elasticsearch.client.Requests#createIndexRequest(String)
* @see CreateIndexResponse

View File

@ -27,14 +27,12 @@ import org.elasticsearch.common.unit.TimeValue;
import java.io.IOException;
import static org.elasticsearch.action.Actions.addValidationError;
import static org.elasticsearch.action.ValidateActions.addValidationError;
import static org.elasticsearch.common.unit.TimeValue.readTimeValue;
import static org.elasticsearch.common.unit.TimeValue.timeValueSeconds;
/**
* A request to delete an index. Best created with {@link org.elasticsearch.client.Requests#deleteIndexRequest(String)}.
*
*
*/
public class DeleteIndexRequest extends MasterNodeOperationRequest {

View File

@ -26,7 +26,7 @@ import org.elasticsearch.common.io.stream.StreamOutput;
import java.io.IOException;
import static org.elasticsearch.action.Actions.addValidationError;
import static org.elasticsearch.action.ValidateActions.addValidationError;
public class IndicesExistsRequest extends MasterNodeOperationRequest {

View File

@ -26,7 +26,7 @@ import org.elasticsearch.common.io.stream.StreamOutput;
import java.io.IOException;
import static org.elasticsearch.action.Actions.addValidationError;
import static org.elasticsearch.action.ValidateActions.addValidationError;
/**
*

View File

@ -35,7 +35,7 @@ import java.io.IOException;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import static org.elasticsearch.action.Actions.addValidationError;
import static org.elasticsearch.action.ValidateActions.addValidationError;
import static org.elasticsearch.common.unit.TimeValue.readTimeValue;
/**
@ -46,7 +46,6 @@ import static org.elasticsearch.common.unit.TimeValue.readTimeValue;
* that can't be merged are detected, the request will be rejected unless the {@link #ignoreConflicts(boolean)}
* is set. In such a case, the duplicate mappings will be rejected.
*
*
* @see org.elasticsearch.client.Requests#putMappingRequest(String...)
* @see org.elasticsearch.client.IndicesAdminClient#putMapping(PutMappingRequest)
* @see PutMappingResponse

View File

@ -27,14 +27,12 @@ import org.elasticsearch.common.unit.TimeValue;
import java.io.IOException;
import static org.elasticsearch.action.Actions.addValidationError;
import static org.elasticsearch.action.ValidateActions.addValidationError;
import static org.elasticsearch.common.unit.TimeValue.readTimeValue;
import static org.elasticsearch.common.unit.TimeValue.timeValueSeconds;
/**
* A request to open an index.
*
*
*/
public class OpenIndexRequest extends MasterNodeOperationRequest {

View File

@ -33,7 +33,7 @@ import org.elasticsearch.common.xcontent.XContentType;
import java.io.IOException;
import java.util.Map;
import static org.elasticsearch.action.Actions.addValidationError;
import static org.elasticsearch.action.ValidateActions.addValidationError;
import static org.elasticsearch.common.settings.ImmutableSettings.Builder.EMPTY_SETTINGS;
import static org.elasticsearch.common.settings.ImmutableSettings.readSettingsFromStream;
import static org.elasticsearch.common.settings.ImmutableSettings.writeSettingsToStream;

View File

@ -27,14 +27,12 @@ import org.elasticsearch.common.unit.TimeValue;
import java.io.IOException;
import static org.elasticsearch.action.Actions.addValidationError;
import static org.elasticsearch.action.ValidateActions.addValidationError;
import static org.elasticsearch.common.unit.TimeValue.readTimeValue;
import static org.elasticsearch.common.unit.TimeValue.timeValueSeconds;
/**
* A request to delete an index template.
*
*
*/
public class DeleteIndexTemplateRequest extends MasterNodeOperationRequest {

View File

@ -38,7 +38,7 @@ import java.util.Map;
import java.util.concurrent.TimeUnit;
import static com.google.common.collect.Maps.newHashMap;
import static org.elasticsearch.action.Actions.addValidationError;
import static org.elasticsearch.action.ValidateActions.addValidationError;
import static org.elasticsearch.common.settings.ImmutableSettings.Builder.EMPTY_SETTINGS;
import static org.elasticsearch.common.settings.ImmutableSettings.readSettingsFromStream;
import static org.elasticsearch.common.settings.ImmutableSettings.writeSettingsToStream;

View File

@ -38,13 +38,12 @@ import org.elasticsearch.index.VersionType;
import java.io.IOException;
import java.util.List;
import static org.elasticsearch.action.Actions.addValidationError;
import static org.elasticsearch.action.ValidateActions.addValidationError;
/**
* A bulk request holds an ordered {@link IndexRequest}s and {@link DeleteRequest}s and allows to executes
* it in a single batch.
*
*
* @see org.elasticsearch.client.Client#bulk(BulkRequest)
*/
public class BulkRequest implements ActionRequest {

View File

@ -32,7 +32,7 @@ import org.elasticsearch.index.VersionType;
import java.io.IOException;
import static org.elasticsearch.action.Actions.addValidationError;
import static org.elasticsearch.action.ValidateActions.addValidationError;
/**
* A request to delete a document from an index based on its type and id. Best created using
@ -41,7 +41,6 @@ import static org.elasticsearch.action.Actions.addValidationError;
* <p>The operation requires the {@link #index()}, {@link #type(String)} and {@link #id(String)} to
* be set.
*
*
* @see DeleteResponse
* @see org.elasticsearch.client.Client#delete(DeleteRequest)
* @see org.elasticsearch.client.Requests#deleteRequest(String)

View File

@ -26,12 +26,10 @@ import org.elasticsearch.common.io.stream.StreamOutput;
import java.io.IOException;
import static org.elasticsearch.action.Actions.addValidationError;
import static org.elasticsearch.action.ValidateActions.addValidationError;
/**
* Delete by query request to execute on a specific shard.
*
*
*/
public class ShardDeleteRequest extends ShardReplicationOperationRequest {

View File

@ -40,7 +40,7 @@ import java.io.IOException;
import java.util.Arrays;
import java.util.Map;
import static org.elasticsearch.action.Actions.addValidationError;
import static org.elasticsearch.action.ValidateActions.addValidationError;
/**
* A request to delete all documents that matching a specific query. Best created with

View File

@ -32,7 +32,7 @@ import org.elasticsearch.common.unit.TimeValue;
import java.io.IOException;
import java.util.Set;
import static org.elasticsearch.action.Actions.addValidationError;
import static org.elasticsearch.action.ValidateActions.addValidationError;
/**
* Delete by query request to execute on a specific index.

View File

@ -33,7 +33,7 @@ import java.io.IOException;
import java.util.Arrays;
import java.util.Set;
import static org.elasticsearch.action.Actions.addValidationError;
import static org.elasticsearch.action.ValidateActions.addValidationError;
/**
* Delete by query request to execute on a specific shard.

View File

@ -20,7 +20,7 @@
package org.elasticsearch.action.get;
import org.elasticsearch.action.ActionRequestValidationException;
import org.elasticsearch.action.Actions;
import org.elasticsearch.action.ValidateActions;
import org.elasticsearch.action.support.single.shard.SingleShardOperationRequest;
import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.Required;
@ -36,7 +36,6 @@ import java.io.IOException;
* <p>The operation requires the {@link #index()}, {@link #type(String)} and {@link #id(String)}
* to be set.
*
*
* @see org.elasticsearch.action.get.GetResponse
* @see org.elasticsearch.client.Requests#getRequest(String)
* @see org.elasticsearch.client.Client#get(GetRequest)
@ -84,10 +83,10 @@ public class GetRequest extends SingleShardOperationRequest {
public ActionRequestValidationException validate() {
ActionRequestValidationException validationException = super.validate();
if (type == null) {
validationException = Actions.addValidationError("type is missing", validationException);
validationException = ValidateActions.addValidationError("type is missing", validationException);
}
if (id == null) {
validationException = Actions.addValidationError("id is missing", validationException);
validationException = ValidateActions.addValidationError("id is missing", validationException);
}
return validationException;
}

View File

@ -22,7 +22,7 @@ package org.elasticsearch.action.get;
import org.elasticsearch.ElasticSearchIllegalArgumentException;
import org.elasticsearch.action.ActionRequest;
import org.elasticsearch.action.ActionRequestValidationException;
import org.elasticsearch.action.Actions;
import org.elasticsearch.action.ValidateActions;
import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
@ -186,15 +186,15 @@ public class MultiGetRequest implements ActionRequest {
public ActionRequestValidationException validate() {
ActionRequestValidationException validationException = null;
if (items.isEmpty()) {
validationException = Actions.addValidationError("no documents to get", validationException);
validationException = ValidateActions.addValidationError("no documents to get", validationException);
} else {
for (int i = 0; i < items.size(); i++) {
Item item = items.get(i);
if (item.index() == null) {
validationException = Actions.addValidationError("index is missing for doc " + i, validationException);
validationException = ValidateActions.addValidationError("index is missing for doc " + i, validationException);
}
if (item.id() == null) {
validationException = Actions.addValidationError("id is missing for doc " + i, validationException);
validationException = ValidateActions.addValidationError("id is missing for doc " + i, validationException);
}
}
}

View File

@ -47,7 +47,7 @@ import java.io.IOException;
import java.util.Arrays;
import java.util.Map;
import static org.elasticsearch.action.Actions.addValidationError;
import static org.elasticsearch.action.ValidateActions.addValidationError;
/**
* Index request to index a typed JSON document into a specific index and make it searchable. Best

View File

@ -24,7 +24,7 @@ import org.elasticsearch.ElasticSearchGenerationException;
import org.elasticsearch.ElasticSearchIllegalArgumentException;
import org.elasticsearch.action.ActionRequest;
import org.elasticsearch.action.ActionRequestValidationException;
import org.elasticsearch.action.Actions;
import org.elasticsearch.action.ValidateActions;
import org.elasticsearch.action.search.SearchType;
import org.elasticsearch.client.Requests;
import org.elasticsearch.common.Bytes;
@ -52,7 +52,6 @@ import static org.elasticsearch.search.Scroll.readScroll;
* <p/>
* <p>Note, the {@link #index()}, {@link #type(String)} and {@link #id(String)} are required.
*
*
* @see org.elasticsearch.client.Client#moreLikeThis(MoreLikeThisRequest)
* @see org.elasticsearch.client.Requests#moreLikeThisRequest(String)
* @see org.elasticsearch.action.search.SearchResponse
@ -526,13 +525,13 @@ public class MoreLikeThisRequest implements ActionRequest {
public ActionRequestValidationException validate() {
ActionRequestValidationException validationException = null;
if (index == null) {
validationException = Actions.addValidationError("index is missing", validationException);
validationException = ValidateActions.addValidationError("index is missing", validationException);
}
if (type == null) {
validationException = Actions.addValidationError("type is missing", validationException);
validationException = ValidateActions.addValidationError("type is missing", validationException);
}
if (id == null) {
validationException = Actions.addValidationError("id is missing", validationException);
validationException = ValidateActions.addValidationError("id is missing", validationException);
}
return validationException;
}

View File

@ -36,7 +36,7 @@ import java.io.IOException;
import java.util.Arrays;
import java.util.Map;
import static org.elasticsearch.action.Actions.addValidationError;
import static org.elasticsearch.action.ValidateActions.addValidationError;
/**
*

View File

@ -43,7 +43,7 @@ import java.io.IOException;
import java.util.Arrays;
import java.util.Map;
import static org.elasticsearch.action.Actions.addValidationError;
import static org.elasticsearch.action.ValidateActions.addValidationError;
import static org.elasticsearch.search.Scroll.readScroll;
/**

View File

@ -28,7 +28,7 @@ import org.elasticsearch.search.Scroll;
import java.io.IOException;
import static org.elasticsearch.action.Actions.addValidationError;
import static org.elasticsearch.action.ValidateActions.addValidationError;
import static org.elasticsearch.search.Scroll.readScroll;
/**

View File

@ -28,7 +28,7 @@ import org.elasticsearch.common.unit.TimeValue;
import java.io.IOException;
import static org.elasticsearch.action.Actions.addValidationError;
import static org.elasticsearch.action.ValidateActions.addValidationError;
/**
*

View File

@ -29,7 +29,7 @@ import org.elasticsearch.common.unit.TimeValue;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import static org.elasticsearch.action.Actions.addValidationError;
import static org.elasticsearch.action.ValidateActions.addValidationError;
/**
*

View File

@ -21,7 +21,7 @@ package org.elasticsearch.action.support.single.instance;
import org.elasticsearch.action.ActionRequest;
import org.elasticsearch.action.ActionRequestValidationException;
import org.elasticsearch.action.Actions;
import org.elasticsearch.action.ValidateActions;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.unit.TimeValue;
@ -59,7 +59,7 @@ public abstract class InstanceShardOperationRequest implements ActionRequest {
public ActionRequestValidationException validate() {
ActionRequestValidationException validationException = null;
if (index == null) {
validationException = Actions.addValidationError("index is missing", validationException);
validationException = ValidateActions.addValidationError("index is missing", validationException);
}
return validationException;
}

View File

@ -21,7 +21,7 @@ package org.elasticsearch.action.support.single.shard;
import org.elasticsearch.action.ActionRequest;
import org.elasticsearch.action.ActionRequestValidationException;
import org.elasticsearch.action.Actions;
import org.elasticsearch.action.ValidateActions;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
@ -48,7 +48,7 @@ public abstract class SingleShardOperationRequest implements ActionRequest {
public ActionRequestValidationException validate() {
ActionRequestValidationException validationException = null;
if (index == null) {
validationException = Actions.addValidationError("index is missing", validationException);
validationException = ValidateActions.addValidationError("index is missing", validationException);
}
return validationException;
}

View File

@ -32,7 +32,7 @@ import org.elasticsearch.common.unit.TimeValue;
import java.io.IOException;
import java.util.Map;
import static org.elasticsearch.action.Actions.addValidationError;
import static org.elasticsearch.action.ValidateActions.addValidationError;
/**
*/