Alias code cleanup

- Renamed IndexMetaData#removerAlias to removeAlias
- Removed IndexTemplateMetaData#fromXContentStandalone unused method (relates to #4511)
- MetaDataIndexAliasesService fix typo in comment
- Alias removed unused constructor that accepts both alias name and filter
This commit is contained in:
javanna 2014-02-19 12:04:30 +01:00 committed by Luca Cavanna
parent 4902dd1da6
commit d3ed795372
4 changed files with 4 additions and 23 deletions

View File

@ -55,11 +55,6 @@ public class Alias implements Streamable {
this.name = name;
}
public Alias(String name, String filter) {
this.name = name;
this.filter = filter;
}
/**
* Returns the alias name
*/

View File

@ -335,6 +335,7 @@ public class IndexMetaData {
return this.customs;
}
@SuppressWarnings("unchecked")
public <T extends Custom> T custom(String type) {
return (T) customs.get(type);
}
@ -505,7 +506,7 @@ public class IndexMetaData {
return this;
}
public Builder removerAlias(String alias) {
public Builder removeAlias(String alias) {
aliases.remove(alias);
return this;
}

View File

@ -284,21 +284,6 @@ public class IndexTemplateMetaData {
builder.endObject();
}
public static IndexTemplateMetaData fromXContentStandalone(XContentParser parser) throws IOException {
XContentParser.Token token = parser.nextToken();
if (token == null) {
throw new IOException("no data");
}
if (token != XContentParser.Token.START_OBJECT) {
throw new IOException("should start object");
}
token = parser.nextToken();
if (token != XContentParser.Token.FIELD_NAME) {
throw new IOException("the first field should be the template name");
}
return fromXContent(parser);
}
public static IndexTemplateMetaData fromXContent(XContentParser parser) throws IOException {
Builder builder = new Builder(parser.currentName());

View File

@ -126,7 +126,7 @@ public class MetaDataIndexAliasesService extends AbstractComponent {
if (indexService == null) {
indexService = indicesService.indexService(indexMetaData.index());
if (indexService == null) {
// temporarily create the index and add mappings so we have can parse the filter
// temporarily create the index and add mappings so we can parse the filter
try {
indexService = indicesService.createIndex(indexMetaData.index(), indexMetaData.settings(), clusterService.localNode().id());
if (indexMetaData.mappings().containsKey(MapperService.DEFAULT_MAPPING)) {
@ -165,7 +165,7 @@ public class MetaDataIndexAliasesService extends AbstractComponent {
// This alias doesn't exist - ignore
continue;
}
indexMetaDataBuilder.removerAlias(aliasAction.alias());
indexMetaDataBuilder.removeAlias(aliasAction.alias());
}
changed = true;
builder.put(indexMetaDataBuilder);