Browse Source

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
javanna 11 years ago
parent
commit
d3ed795372

+ 0 - 5
src/main/java/org/elasticsearch/action/admin/indices/alias/Alias.java

@@ -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
      */

+ 2 - 1
src/main/java/org/elasticsearch/cluster/metadata/IndexMetaData.java

@@ -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;
         }

+ 0 - 15
src/main/java/org/elasticsearch/cluster/metadata/IndexTemplateMetaData.java

@@ -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());
 

+ 2 - 2
src/main/java/org/elasticsearch/cluster/metadata/MetaDataIndexAliasesService.java

@@ -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);