if (cursor.value.context().contains(context)) { builder.startObject(cursor.key); cursor.value.toXContent(builder, params); builder.endObject();
try { Custom custom = parser.namedObject(Custom.class, currentFieldName, null); builder.putCustom(custom.getWriteableName(), custom); } catch (NamedObjectNotFoundException ex) { logger.warn("Skipping unknown custom object with type {}", currentFieldName);
if (cursor.value.context().contains(context)) { builder.startObject(cursor.key); cursor.value.toXContent(builder, params);
cursor.value.toXContent(builder, params); builder.endObject();
cursor.value.toXContent(builder, params); builder.endObject();
cursor.value.toXContent(builder, params); builder.endObject();
cursor.value.toXContent(builder, params); builder.endObject();
try { Custom custom = parser.namedObject(Custom.class, currentFieldName, null); builder.putCustom(custom.getWriteableName(), custom); } catch (NamedObjectNotFoundException ex) { logger.warn("Skipping unknown custom object with type {}", currentFieldName);
if (custom.value.context().contains(MetaData.XContentContext.API) == false) { mdBuilder.removeCustom(custom.key);
try { Custom custom = parser.namedObject(Custom.class, currentFieldName, null); builder.putCustom(custom.getWriteableName(), custom); } catch (NamedObjectNotFoundException ex) { logger.warn("Skipping unknown custom object with type {}", currentFieldName);
if(!custom.value.context().contains(MetaData.XContentContext.API)) { mdBuilder.removeCustom(custom.key);
try { Custom custom = parser.namedObject(Custom.class, currentFieldName, null); builder.putCustom(custom.getWriteableName(), custom); } catch (UnknownNamedObjectException ex) { logger.warn("Skipping unknown custom object with type {}", currentFieldName);
Custom custom = proto.fromXContent(parser); builder.putCustom(custom.type(), custom);
if (custom.value.context().contains(MetaData.XContentContext.API) == false) { mdBuilder.removeCustom(custom.key);
if(!custom.value.context().contains(MetaData.XContentContext.API)) { mdBuilder.removeCustom(custom.key);
if (proto.context().contains(context)) { builder.startObject(cursor.key); cursor.value.toXContent(builder, params); builder.endObject();
if (cursor.value.context().contains(context)) { builder.startObject(cursor.key); cursor.value.toXContent(builder, params); builder.endObject();
if (cursor.value.context().contains(context)) { builder.startObject(cursor.key); cursor.value.toXContent(builder, params); builder.endObject();
@Override public void writeTo(StreamOutput out) throws IOException { out.writeLong(version); out.writeString(clusterUUID); writeSettingsToStream(transientSettings, out); writeSettingsToStream(persistentSettings, out); out.writeVInt(indices.size()); for (IndexMetaData indexMetaData : this) { indexMetaData.writeTo(out); } out.writeVInt(templates.size()); for (ObjectCursor<IndexTemplateMetaData> cursor : templates.values()) { cursor.value.writeTo(out); } // filter out custom states not supported by the other node int numberOfCustoms = 0; for (ObjectCursor<Custom> cursor : customs.values()) { if (out.getVersion().onOrAfter(cursor.value.getMinimalSupportedVersion())) { numberOfCustoms++; } } out.writeVInt(numberOfCustoms); for (ObjectCursor<Custom> cursor : customs.values()) { if (out.getVersion().onOrAfter(cursor.value.getMinimalSupportedVersion())) { out.writeNamedWriteable(cursor.value); } } }
public static boolean isGlobalStateEquals(MetaData metaData1, MetaData metaData2) { if (!metaData1.persistentSettings.equals(metaData2.persistentSettings)) { return false; } if (!metaData1.templates.equals(metaData2.templates())) { return false; } // Check if any persistent metadata needs to be saved int customCount1 = 0; for (ObjectObjectCursor<String, Custom> cursor : metaData1.customs) { if (customPrototypes.get(cursor.key).context().contains(XContentContext.GATEWAY)) { if (!cursor.value.equals(metaData2.custom(cursor.key))) return false; customCount1++; } } int customCount2 = 0; for (ObjectObjectCursor<String, Custom> cursor : metaData2.customs) { if (customPrototypes.get(cursor.key).context().contains(XContentContext.GATEWAY)) { customCount2++; } } if (customCount1 != customCount2) return false; return true; }