aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/DocumentModelBuilder.java9
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/FieldOperationApplierForStructs.java1
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/derived/IndexSchema.java1
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/document/ImmutableImportedSDField.java5
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/document/ImmutableSDField.java3
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/document/SDDocumentType.java7
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/BodyOperation.java14
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/HeaderOperation.java14
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/processing/AddExtraFieldsToDocument.java1
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/configmodel/producers/DocumentManager.java3
-rw-r--r--config-model/src/main/javacc/SDParser.jj3
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/SearchImporterTestCase.java7
-rw-r--r--docproc/src/main/java/com/yahoo/docproc/proxy/ProxyDocument.java4
-rw-r--r--docproc/src/test/java/com/yahoo/docproc/proxy/SchemaMappingAndAccessesTest.java1
-rw-r--r--document/src/main/java/com/yahoo/document/Document.java24
-rwxr-xr-xdocument/src/main/java/com/yahoo/document/DocumentType.java28
-rw-r--r--document/src/main/java/com/yahoo/document/DocumentTypeManagerConfigurer.java1
-rw-r--r--document/src/main/java/com/yahoo/document/Field.java13
-rw-r--r--document/src/main/java/com/yahoo/document/fieldset/BodyFields.java2
-rw-r--r--document/src/main/java/com/yahoo/document/fieldset/FieldSetRepo.java2
-rw-r--r--document/src/main/java/com/yahoo/document/fieldset/HeaderFields.java2
-rw-r--r--document/src/main/java/com/yahoo/document/serialization/VespaDocumentSerializer42.java18
-rw-r--r--document/src/main/java/com/yahoo/document/serialization/XmlSerializationHelper.java1
-rw-r--r--document/src/test/java/com/yahoo/document/DocumentSerializationTestCase.java7
-rw-r--r--document/src/test/java/com/yahoo/document/DocumentTestCase.java11
-rw-r--r--document/src/test/java/com/yahoo/document/DocumentTypeManagerTestCase.java1
-rw-r--r--document/src/test/java/com/yahoo/document/datatypes/StringTestCase.java1
-rw-r--r--document/src/test/java/com/yahoo/document/fieldset/FieldSetTestCase.java3
-rw-r--r--documentgen-test/src/test/java/com/yahoo/vespa/config/DocumentGenPluginTest.java1
-rw-r--r--vdslib/src/main/java/com/yahoo/vdslib/DynamicDocumentList.java12
-rw-r--r--vespa-documentgen-plugin/src/main/java/com/yahoo/vespa/DocumentGenMojo.java73
-rw-r--r--vespaclient-container-plugin/src/test/java/com/yahoo/document/restapi/resource/MockedOperationHandler.java1
32 files changed, 157 insertions, 117 deletions
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/DocumentModelBuilder.java b/config-model/src/main/java/com/yahoo/searchdefinition/DocumentModelBuilder.java
index b4d72f3a456..6387cfbdc85 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/DocumentModelBuilder.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/DocumentModelBuilder.java
@@ -302,11 +302,11 @@ public class DocumentModelBuilder {
private static StructDataType handleStruct(NewDocumentType dt, SDDocumentType type) {
StructDataType s = new StructDataType(type.getName());
- for (Field f : type.getDocumentType().getHeaderType().getFieldsThisTypeOnly()) {
+ for (Field f : type.getDocumentType().getContentType().getFieldsThisTypeOnly()) {
specialHandleAnnotationReference(dt, f);
s.addField(f);
}
- for (StructDataType inherited : type.getDocumentType().getHeaderType().getInheritedTypes()) {
+ for (StructDataType inherited : type.getDocumentType().getContentType().getInheritedTypes()) {
s.inherit(inherited);
}
extractNestedTypes(dt, s);
@@ -330,11 +330,12 @@ public class DocumentModelBuilder {
}
return false;
}
+ @SuppressWarnings("deprecation")
private NewDocumentType convert(SDDocumentType sdoc) {
Map<AnnotationType, String> annotationInheritance = new HashMap<>();
Map<StructDataType, String> structInheritance = new HashMap<>();
NewDocumentType dt = new NewDocumentType(new NewDocumentType.Name(sdoc.getName()),
- sdoc.getDocumentType().getHeaderType(),
+ sdoc.getDocumentType().getContentType(),
sdoc.getDocumentType().getBodyType(),
sdoc.getFieldSets(),
convertDocumentReferencesToNames(sdoc.getDocumentReferences()));
@@ -386,7 +387,7 @@ public class DocumentModelBuilder {
e.getKey().inherit(s);
}
}
- handleStruct(dt, sdoc.getDocumentType().getHeaderType());
+ handleStruct(dt, sdoc.getDocumentType().getContentType());
handleStruct(dt, sdoc.getDocumentType().getBodyType());
extractDataTypesFromFields(dt, sdoc.fieldSet());
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/FieldOperationApplierForStructs.java b/config-model/src/main/java/com/yahoo/searchdefinition/FieldOperationApplierForStructs.java
index 04b0fc6e331..9ff749a994c 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/FieldOperationApplierForStructs.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/FieldOperationApplierForStructs.java
@@ -25,6 +25,7 @@ public class FieldOperationApplierForStructs extends FieldOperationApplier {
}
}
+ @SuppressWarnings("deprecation")
private void copyFields(SDDocumentType structType, SDDocumentType sdoc) {
//find all fields in OTHER types that have this type:
List<SDDocumentType> list = new ArrayList<>();
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/derived/IndexSchema.java b/config-model/src/main/java/com/yahoo/searchdefinition/derived/IndexSchema.java
index 4566d188c45..39d51414607 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/derived/IndexSchema.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/derived/IndexSchema.java
@@ -133,6 +133,7 @@ public class IndexSchema extends Derived implements IndexschemaConfig.Producer {
}
}
+ @SuppressWarnings("deprecation")
static List<Field> flattenField(Field field) {
DataType fieldType = field.getDataType();
if (fieldType.getPrimitiveType() != null){
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/document/ImmutableImportedSDField.java b/config-model/src/main/java/com/yahoo/searchdefinition/document/ImmutableImportedSDField.java
index dc2a1a2bbae..e1253d14747 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/document/ImmutableImportedSDField.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/document/ImmutableImportedSDField.java
@@ -58,11 +58,6 @@ public class ImmutableImportedSDField implements ImmutableSDField {
}
@Override
- public boolean isHeader() {
- return importedField.targetField().isHeader();
- }
-
- @Override
public boolean isImportedField() {
return true;
}
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/document/ImmutableSDField.java b/config-model/src/main/java/com/yahoo/searchdefinition/document/ImmutableSDField.java
index 4ae7561a7bc..21ef60cf0b9 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/document/ImmutableSDField.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/document/ImmutableSDField.java
@@ -10,7 +10,6 @@ import com.yahoo.vespa.indexinglanguage.expressions.Expression;
import com.yahoo.vespa.indexinglanguage.expressions.ScriptExpression;
import java.util.Collection;
-import java.util.Collections;
import java.util.List;
import java.util.Map;
@@ -32,8 +31,6 @@ public interface ImmutableSDField {
boolean isExtraField();
- boolean isHeader();
-
boolean isImportedField();
/**
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/document/SDDocumentType.java b/config-model/src/main/java/com/yahoo/searchdefinition/document/SDDocumentType.java
index 98be4900ef6..0e9e09844d1 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/document/SDDocumentType.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/document/SDDocumentType.java
@@ -148,9 +148,10 @@ public class SDDocumentType implements Cloneable, Serializable {
* @param name The name of the new document type
* @param search check for type ID collisions in this search definition
*/
+ @SuppressWarnings("deprecation")
public SDDocumentType(String name, Search search) {
docType = new DocumentType(name);
- docType.getHeaderType().setCompressionConfig(new CompressionConfig());
+ docType.getContentType().setCompressionConfig(new CompressionConfig());
docType.getBodyType().setCompressionConfig(new CompressionConfig());
validateId(search);
inherit(VESPA_DOCUMENT);
@@ -163,8 +164,8 @@ public class SDDocumentType implements Cloneable, Serializable {
this.structType = structType;
inheritedTypes.clear();
} else {
- if (docType.getHeaderType() != null) {
- this.structType = docType.getHeaderType();
+ if (docType.getContentType() != null) {
+ this.structType = docType.getContentType();
inheritedTypes.clear();
} else {
throw new IllegalArgumentException("You can not set a null struct");
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/BodyOperation.java b/config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/BodyOperation.java
deleted file mode 100644
index 7ea11873a12..00000000000
--- a/config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/BodyOperation.java
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-package com.yahoo.searchdefinition.fieldoperation;
-
-import com.yahoo.searchdefinition.document.SDField;
-
-/**
- * @author <a href="mailto:einarmr@yahoo-inc.com">Einar M R Rosenvinge</a>
- */
-public class BodyOperation implements FieldOperation {
- public void apply(SDField field) {
- field.setHeader(false);
- field.setHeaderOrBodyDefined(true);
- }
-}
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/HeaderOperation.java b/config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/HeaderOperation.java
deleted file mode 100644
index 22d85f89105..00000000000
--- a/config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/HeaderOperation.java
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-package com.yahoo.searchdefinition.fieldoperation;
-
-import com.yahoo.searchdefinition.document.SDField;
-
-/**
- * @author <a href="mailto:einarmr@yahoo-inc.com">Einar M R Rosenvinge</a>
- */
-public class HeaderOperation implements FieldOperation {
- public void apply(SDField field) {
- field.setHeader(true);
- field.setHeaderOrBodyDefined(true);
- }
-}
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/processing/AddExtraFieldsToDocument.java b/config-model/src/main/java/com/yahoo/searchdefinition/processing/AddExtraFieldsToDocument.java
index 803a6c5ab40..b62639961bf 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/processing/AddExtraFieldsToDocument.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/processing/AddExtraFieldsToDocument.java
@@ -56,6 +56,7 @@ public class AddExtraFieldsToDocument extends Processor {
addField(search, document, field, validate);
}
+ @SuppressWarnings("deprecation")
private void addSummaryField(Search search, SDDocumentType document, SummaryField field, boolean validate) {
Field docField = document.getField(field.getName());
if (docField == null) {
diff --git a/config-model/src/main/java/com/yahoo/vespa/configmodel/producers/DocumentManager.java b/config-model/src/main/java/com/yahoo/vespa/configmodel/producers/DocumentManager.java
index 9368d6aaa39..9e07171c183 100644
--- a/config-model/src/main/java/com/yahoo/vespa/configmodel/producers/DocumentManager.java
+++ b/config-model/src/main/java/com/yahoo/vespa/configmodel/producers/DocumentManager.java
@@ -70,6 +70,7 @@ public class DocumentManager {
}
}
+ @SuppressWarnings("deprecation")
private void buildConfig(DataType type, Datatype.Builder builder) {
builder.id(type.getId());
if (type instanceof ArrayDataType) {
@@ -92,7 +93,7 @@ public class DocumentManager {
builder.documenttype(doc);
doc.
name(dt.getName()).
- headerstruct(dt.getHeaderType().getId()).
+ headerstruct(dt.getContentType().getId()).
bodystruct(dt.getBodyType().getId());
for (DocumentType inherited : dt.getInheritedTypes()) {
doc.inherits(new Datatype.Documenttype.Inherits.Builder().name(inherited.getName()));
diff --git a/config-model/src/main/javacc/SDParser.jj b/config-model/src/main/javacc/SDParser.jj
index d1c67a6d425..20a0e04b15a 100644
--- a/config-model/src/main/javacc/SDParser.jj
+++ b/config-model/src/main/javacc/SDParser.jj
@@ -70,6 +70,7 @@ import org.apache.commons.lang.StringUtils;
*
* @author bratseth
*/
+ @SuppressWarnings("deprecation")
public class SDParser {
private DocumentTypeManager docMan = null;
@@ -579,7 +580,7 @@ void compression(SDDocumentType document, String name) :
<COMPRESSION> lbrace() (cfg = compressionItem(cfg) (<NL>)*)* <RBRACE>
{
if (name == null || name.equals("header")) {
- document.getDocumentType().getHeaderType().setCompressionConfig(cfg);
+ document.getDocumentType().getContentType().setCompressionConfig(cfg);
}
if (name == null || name.equals("body")) {
document.getDocumentType().getBodyType().setCompressionConfig(cfg);
diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/SearchImporterTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/SearchImporterTestCase.java
index 127ed7a528b..0c464d668f7 100644
--- a/config-model/src/test/java/com/yahoo/searchdefinition/SearchImporterTestCase.java
+++ b/config-model/src/test/java/com/yahoo/searchdefinition/SearchImporterTestCase.java
@@ -19,7 +19,11 @@ import org.junit.Test;
import java.io.IOException;
import java.util.Iterator;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
/**
* Tests importing of search definitions
@@ -29,6 +33,7 @@ import static org.junit.Assert.*;
public class SearchImporterTestCase extends SearchDefinitionTestCase {
@Test
+ @SuppressWarnings("deprecation")
public void testSimpleImporting() throws IOException, ParseException {
RankProfileRegistry rankProfileRegistry = new RankProfileRegistry();
SearchBuilder sb = new SearchBuilder(rankProfileRegistry, new QueryProfileRegistry());
diff --git a/docproc/src/main/java/com/yahoo/docproc/proxy/ProxyDocument.java b/docproc/src/main/java/com/yahoo/docproc/proxy/ProxyDocument.java
index 23555efec50..ac9310784f2 100644
--- a/docproc/src/main/java/com/yahoo/docproc/proxy/ProxyDocument.java
+++ b/docproc/src/main/java/com/yahoo/docproc/proxy/ProxyDocument.java
@@ -228,11 +228,13 @@ public class ProxyDocument extends Document implements DocumentOperationWrapper
}
@Override
+ @SuppressWarnings("deprecation")
public Struct getHeader() {
return doc.getHeader();
}
@Override
+ @SuppressWarnings("deprecation")
public Struct getBody() {
return doc.getBody();
}
@@ -288,11 +290,13 @@ public class ProxyDocument extends Document implements DocumentOperationWrapper
}
@Override
+ @SuppressWarnings("deprecation")
public void serializeHeader(Serializer target) throws SerializationException {
doc.serializeHeader(target);
}
@Override
+ @SuppressWarnings("deprecation")
public void serializeBody(Serializer target) throws SerializationException {
doc.serializeBody(target);
}
diff --git a/docproc/src/test/java/com/yahoo/docproc/proxy/SchemaMappingAndAccessesTest.java b/docproc/src/test/java/com/yahoo/docproc/proxy/SchemaMappingAndAccessesTest.java
index e6de3190156..20212d6ef4c 100644
--- a/docproc/src/test/java/com/yahoo/docproc/proxy/SchemaMappingAndAccessesTest.java
+++ b/docproc/src/test/java/com/yahoo/docproc/proxy/SchemaMappingAndAccessesTest.java
@@ -280,6 +280,7 @@ public class SchemaMappingAndAccessesTest {
}
@Test
+ @SuppressWarnings("deprecation")
public void testMappedDocAPI() {
Document doc = getDoc();
Map<String, String> fieldMap = new HashMap<>();
diff --git a/document/src/main/java/com/yahoo/document/Document.java b/document/src/main/java/com/yahoo/document/Document.java
index 23beab7523e..55183f8fa70 100644
--- a/document/src/main/java/com/yahoo/document/Document.java
+++ b/document/src/main/java/com/yahoo/document/Document.java
@@ -99,7 +99,9 @@ public class Document extends StructuredFieldValue {
docId = id;
}
+ @Deprecated
public Struct getHeader() { return header; }
+ @Deprecated
public Struct getBody() { return body; }
@Override
@@ -116,8 +118,9 @@ public class Document extends StructuredFieldValue {
return doc;
}
+ @SuppressWarnings("deprecation")
private void setNewType(DocumentType type) {
- header = type.getHeaderType().createFieldValue();
+ header = type.getContentType().createFieldValue();
body = type.getBodyType().createFieldValue();
}
@@ -188,14 +191,15 @@ public class Document extends StructuredFieldValue {
@Override
public FieldValue getFieldValue(Field field) {
- if (field.isHeader()) {
- return header.getFieldValue(field);
- } else {
- return body.getFieldValue(field);
+ FieldValue fv = header.getFieldValue(field);
+ if (fv == null) {
+ fv = body.getFieldValue(field);
}
+ return fv;
}
@Override
+ @SuppressWarnings("deprecation")
protected void doSetFieldValue(Field field, FieldValue value) {
if (field.isHeader()) {
header.setFieldValue(field, value);
@@ -206,11 +210,11 @@ public class Document extends StructuredFieldValue {
@Override
public FieldValue removeFieldValue(Field field) {
- if (field.isHeader()) {
- return header.removeFieldValue(field);
- } else {
- return body.removeFieldValue(field);
+ FieldValue removed = header.removeFieldValue(field);
+ if (removed == null) {
+ removed = body.removeFieldValue(field);
}
+ return removed;
}
@Override
@@ -338,6 +342,7 @@ public class Document extends StructuredFieldValue {
}
@SuppressWarnings("deprecation")
+ @Deprecated
public void serializeHeader(Serializer data) throws SerializationException {
if (data instanceof DocumentWriter) {
if (data instanceof com.yahoo.document.serialization.VespaDocumentSerializer42) {
@@ -353,6 +358,7 @@ public class Document extends StructuredFieldValue {
}
}
+ @Deprecated
public void serializeBody(Serializer data) throws SerializationException {
if (getBody().getFieldCount() > 0) {
if (data instanceof FieldWriter) {
diff --git a/document/src/main/java/com/yahoo/document/DocumentType.java b/document/src/main/java/com/yahoo/document/DocumentType.java
index 61e9a9ba83f..f2a501100f2 100755
--- a/document/src/main/java/com/yahoo/document/DocumentType.java
+++ b/document/src/main/java/com/yahoo/document/DocumentType.java
@@ -9,7 +9,17 @@ import com.yahoo.vespa.objects.Ids;
import com.yahoo.vespa.objects.ObjectVisitor;
import com.yahoo.vespa.objects.Serializer;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Map;
+import java.util.Set;
+
/**
* <p>A document definition is a list of fields. Documents may inherit other documents,
@@ -19,12 +29,13 @@ import java.util.*;
* @author <a href="mailto:thomasg@yahoo-inc.com">Thomas Gundersen</a>
* @author bratseth
*/
+// TODO Vespa 7 Remove header/body concept
public class DocumentType extends StructuredDataType {
public static final int classId = registerClass(Ids.document + 58, DocumentType.class);
private StructDataType headerType;
private StructDataType bodyType;
- private List<DocumentType> inherits = new ArrayList<DocumentType>(1);
+ private List<DocumentType> inherits = new ArrayList<>(1);
/**
* Creates a new document type and registers it with the document type manager.
@@ -89,15 +100,23 @@ public class DocumentType extends StructuredDataType {
return false;
}
- public StructDataType getHeaderType() {
+ public StructDataType getContentType() {
return headerType;
}
+ // Use getContentType instead
+ @Deprecated
+ public StructDataType getHeaderType() {
+ return getContentType();
+ }
+
+ @Deprecated
public StructDataType getBodyType() {
return bodyType;
}
@Override
+ @SuppressWarnings("deprecation")
protected void register(DocumentTypeManager manager, List<DataType> seenTypes) {
seenTypes.add(this);
for (DocumentType type : getInheritedTypes()) {
@@ -148,6 +167,7 @@ public class DocumentType extends StructuredDataType {
*
* @param field the field to add
*/
+ @SuppressWarnings("deprecation")
public void addField(Field field) {
if (isRegistered()) {
throw new IllegalStateException("You cannot add fields to a document type that is already registered.");
@@ -397,7 +417,7 @@ public class DocumentType extends StructuredDataType {
* @return an unmodifiable snapshot of the fields in this type
*/
public Set<Field> fieldSet() {
- Map<String, Field> map = new LinkedHashMap<String, Field>();
+ Map<String, Field> map = new LinkedHashMap<>();
for (Field field : getFields()) { // Uniqify on field name
map.put(field.getName(), field);
}
diff --git a/document/src/main/java/com/yahoo/document/DocumentTypeManagerConfigurer.java b/document/src/main/java/com/yahoo/document/DocumentTypeManagerConfigurer.java
index 7678360ea30..be5c6856ee5 100644
--- a/document/src/main/java/com/yahoo/document/DocumentTypeManagerConfigurer.java
+++ b/document/src/main/java/com/yahoo/document/DocumentTypeManagerConfigurer.java
@@ -134,6 +134,7 @@ public class DocumentTypeManagerConfigurer implements ConfigSubscriber.SingleSub
manager.register(type);
}
+ @SuppressWarnings("deprecation")
private static void registerDocumentType(DocumentTypeManager manager, DocumentmanagerConfig.Datatype.Documenttype doc) {
StructDataType header = (StructDataType) manager.getDataType(doc.headerstruct(), "");
StructDataType body = (StructDataType) manager.getDataType(doc.bodystruct(), "");
diff --git a/document/src/main/java/com/yahoo/document/Field.java b/document/src/main/java/com/yahoo/document/Field.java
index 4098c85b3e3..16ce69453ab 100644
--- a/document/src/main/java/com/yahoo/document/Field.java
+++ b/document/src/main/java/com/yahoo/document/Field.java
@@ -16,6 +16,7 @@ import java.io.Serializable;
* @author Thomas Gundersen
* @author bratseth
*/
+//TODO Vespa 7 Remove deprecated methods.
public class Field extends FieldBase implements FieldSet, Comparable, Serializable {
protected DataType dataType;
@@ -214,12 +215,20 @@ public class Field extends FieldBase implements FieldSet, Comparable, Serializab
return forcedId;
}
- /** @return Returns true if this field should be a part of "header" serializations. */
+ /**
+ * NB: Has no longer any semantic meaning as this is no longer an aspect with a field.
+ * @return Returns true if this field should be a part of "header" serializations.
+ */
+ @Deprecated
public boolean isHeader() {
return isHeader;
}
- /** Sets whether this is a header field */
+ /**
+ * NB: Has no longer any semantic meaning as this is no longer an aspect with a field.
+ * Sets whether this is a header field
+ */
+ @Deprecated
public void setHeader(boolean header) {
this.isHeader = header;
}
diff --git a/document/src/main/java/com/yahoo/document/fieldset/BodyFields.java b/document/src/main/java/com/yahoo/document/fieldset/BodyFields.java
index 912ec798fdb..72c48684b86 100644
--- a/document/src/main/java/com/yahoo/document/fieldset/BodyFields.java
+++ b/document/src/main/java/com/yahoo/document/fieldset/BodyFields.java
@@ -10,6 +10,8 @@ import com.yahoo.document.Field;
* Time: 3:18 PM
* To change this template use File | Settings | File Templates.
*/
+//TODO Vespa 7 Remove
+@Deprecated
public class BodyFields implements FieldSet {
@Override
public boolean contains(FieldSet o) {
diff --git a/document/src/main/java/com/yahoo/document/fieldset/FieldSetRepo.java b/document/src/main/java/com/yahoo/document/fieldset/FieldSetRepo.java
index 38ea190b0d4..a7035439903 100644
--- a/document/src/main/java/com/yahoo/document/fieldset/FieldSetRepo.java
+++ b/document/src/main/java/com/yahoo/document/fieldset/FieldSetRepo.java
@@ -15,6 +15,7 @@ import java.util.*;
*/
public class FieldSetRepo {
+ @SuppressWarnings("deprecation")
FieldSet parseSpecialValues(String name)
{
if (name.equals("[id]")) { return new DocIdOnly(); }
@@ -73,6 +74,7 @@ public class FieldSetRepo {
return parseFieldCollection(docMan, type, fields);
}
+ @SuppressWarnings("deprecation")
public String serialize(FieldSet fieldSet) {
if (fieldSet instanceof Field) {
return ((Field)fieldSet).getName();
diff --git a/document/src/main/java/com/yahoo/document/fieldset/HeaderFields.java b/document/src/main/java/com/yahoo/document/fieldset/HeaderFields.java
index e3b8befa226..ee55bd88faf 100644
--- a/document/src/main/java/com/yahoo/document/fieldset/HeaderFields.java
+++ b/document/src/main/java/com/yahoo/document/fieldset/HeaderFields.java
@@ -10,6 +10,8 @@ import com.yahoo.document.Field;
* Time: 3:18 PM
* To change this template use File | Settings | File Templates.
*/
+//TODO Vespa 7 Remove
+@Deprecated
public class HeaderFields implements FieldSet {
@Override
public boolean contains(FieldSet o) {
diff --git a/document/src/main/java/com/yahoo/document/serialization/VespaDocumentSerializer42.java b/document/src/main/java/com/yahoo/document/serialization/VespaDocumentSerializer42.java
index c3bf9303529..460d35ed266 100644
--- a/document/src/main/java/com/yahoo/document/serialization/VespaDocumentSerializer42.java
+++ b/document/src/main/java/com/yahoo/document/serialization/VespaDocumentSerializer42.java
@@ -71,8 +71,6 @@ import static com.yahoo.text.Utf8.calculateBytePositions;
// When removing: Move content into VespaDocumentSerializerHead
public class VespaDocumentSerializer42 extends BufferSerializer implements DocumentSerializer {
- private final Compressor compressor = new Compressor();
- private final static Logger log = Logger.getLogger(VespaDocumentSerializer42.class.getName());
private boolean headerOnly;
private int spanNodeCounter = -1;
private int[] bytePositions;
@@ -81,14 +79,6 @@ public class VespaDocumentSerializer42 extends BufferSerializer implements Docum
super(buf);
}
- VespaDocumentSerializer42(ByteBuffer buf) {
- super(buf);
- }
-
- VespaDocumentSerializer42(byte[] buf) {
- super(buf);
- }
-
VespaDocumentSerializer42() {
super();
}
@@ -460,14 +450,6 @@ public class VespaDocumentSerializer42 extends BufferSerializer implements Docum
putShort(null, (short) 0); // Used to hold the version. Is now always 0.
}
-
- private static void serializeAttributeString(GrowableByteBuffer data, String input) {
- byte[] inputBytes = createUTF8CharArray(input);
- data.put((byte) (inputBytes.length));
- data.put(inputBytes);
- data.put((byte) 0);
- }
-
public void write(Annotation annotation) {
buf.putInt(annotation.getType().getId()); //name hash
diff --git a/document/src/main/java/com/yahoo/document/serialization/XmlSerializationHelper.java b/document/src/main/java/com/yahoo/document/serialization/XmlSerializationHelper.java
index f2f7cc88d00..941dbc8d406 100644
--- a/document/src/main/java/com/yahoo/document/serialization/XmlSerializationHelper.java
+++ b/document/src/main/java/com/yahoo/document/serialization/XmlSerializationHelper.java
@@ -47,6 +47,7 @@ public class XmlSerializationHelper {
xml.addContent(b.toString());
}
+ @SuppressWarnings("deprecation")
public static void printDocumentXml(Document doc, XmlStream xml) {
xml.addAttribute("documenttype", doc.getDataType().getName());
xml.addAttribute("documentid", doc.getId());
diff --git a/document/src/test/java/com/yahoo/document/DocumentSerializationTestCase.java b/document/src/test/java/com/yahoo/document/DocumentSerializationTestCase.java
index 8090138ed2a..6e842c68641 100644
--- a/document/src/test/java/com/yahoo/document/DocumentSerializationTestCase.java
+++ b/document/src/test/java/com/yahoo/document/DocumentSerializationTestCase.java
@@ -57,6 +57,7 @@ import static org.junit.Assert.assertTrue;
public class DocumentSerializationTestCase extends AbstractTypesTest {
@Test
+ @SuppressWarnings("deprecation")
public void testSerializationAllVersions() throws IOException {
DocumentType docInDocType = new DocumentType("docindoc");
@@ -111,18 +112,18 @@ public class DocumentSerializationTestCase extends AbstractTypesTest {
CompressionConfig noncomp = new CompressionConfig();
CompressionConfig lz4comp = new CompressionConfig(CompressionType.LZ4);
{
- doc.getDataType().getHeaderType().setCompressionConfig(noncomp);
+ doc.getDataType().getContentType().setCompressionConfig(noncomp);
doc.getDataType().getBodyType().setCompressionConfig(noncomp);
FileOutputStream fout = new FileOutputStream(path + "document-java-currentversion-uncompressed.dat", false);
doc.serialize(fout);
fout.close();
}
{
- doc.getDataType().getHeaderType().setCompressionConfig(lz4comp);
+ doc.getDataType().getContentType().setCompressionConfig(lz4comp);
doc.getDataType().getBodyType().setCompressionConfig(lz4comp);
FileOutputStream fout = new FileOutputStream(path + "document-java-currentversion-lz4-9.dat", false);
doc.serialize(fout);
- doc.getDataType().getHeaderType().setCompressionConfig(noncomp);
+ doc.getDataType().getContentType().setCompressionConfig(noncomp);
doc.getDataType().getBodyType().setCompressionConfig(noncomp);
fout.close();
}
diff --git a/document/src/test/java/com/yahoo/document/DocumentTestCase.java b/document/src/test/java/com/yahoo/document/DocumentTestCase.java
index 84b33b3881c..855aea1c9b3 100644
--- a/document/src/test/java/com/yahoo/document/DocumentTestCase.java
+++ b/document/src/test/java/com/yahoo/document/DocumentTestCase.java
@@ -752,6 +752,7 @@ public class DocumentTestCase extends DocumentTestCaseBase {
}
@Test
+ @SuppressWarnings("deprecation")
public void testGenerateSerializedFile() throws IOException {
docMan = setUpCppDocType();
@@ -805,12 +806,12 @@ public class DocumentTestCase extends DocumentTestCaseBase {
CompressionConfig noncomp = new CompressionConfig();
CompressionConfig lz4comp = new CompressionConfig(CompressionType.LZ4);
- doc.getDataType().getHeaderType().setCompressionConfig(lz4comp);
+ doc.getDataType().getContentType().setCompressionConfig(lz4comp);
doc.getDataType().getBodyType().setCompressionConfig(lz4comp);
buf = new GrowableByteBuffer(size, 2.0f);
doc.serialize(buf);
- doc.getDataType().getHeaderType().setCompressionConfig(noncomp);
+ doc.getDataType().getContentType().setCompressionConfig(noncomp);
doc.getDataType().getBodyType().setCompressionConfig(noncomp);
fos = new FileOutputStream("src/tests/data/serializejava-compressed.dat");
fos.write(buf.array(), 0, buf.position());
@@ -818,6 +819,7 @@ public class DocumentTestCase extends DocumentTestCaseBase {
}
@Test
+ @SuppressWarnings("deprecation")
public void testSerializeDeserialize() {
setUpSertestDocType();
Document doc = getSertestDocument();
@@ -900,6 +902,7 @@ public class DocumentTestCase extends DocumentTestCaseBase {
}
@Test
+ @SuppressWarnings("deprecation")
public void testSerializeDeserializeCompressed() {
setUpSertestDocType();
Document doc = getSertestDocument();
@@ -907,13 +910,13 @@ public class DocumentTestCase extends DocumentTestCaseBase {
CompressionConfig noncomp = new CompressionConfig();
CompressionConfig lz4comp = new CompressionConfig(CompressionType.LZ4);
- doc.getDataType().getHeaderType().setCompressionConfig(lz4comp);
+ doc.getDataType().getContentType().setCompressionConfig(lz4comp);
doc.getDataType().getBodyType().setCompressionConfig(lz4comp);
GrowableByteBuffer data = new GrowableByteBuffer();
doc.serialize(data);
int size = doc.getSerializedSize();
- doc.getDataType().getHeaderType().setCompressionConfig(noncomp);
+ doc.getDataType().getContentType().setCompressionConfig(noncomp);
doc.getDataType().getBodyType().setCompressionConfig(noncomp);
assertEquals(size, data.position());
diff --git a/document/src/test/java/com/yahoo/document/DocumentTypeManagerTestCase.java b/document/src/test/java/com/yahoo/document/DocumentTypeManagerTestCase.java
index 6acae4f37c6..65c217e09e1 100644
--- a/document/src/test/java/com/yahoo/document/DocumentTypeManagerTestCase.java
+++ b/document/src/test/java/com/yahoo/document/DocumentTypeManagerTestCase.java
@@ -24,6 +24,7 @@ public class DocumentTypeManagerTestCase {
// Verify that we can register and retrieve fields.
@Test
+ @SuppressWarnings("deprecation")
public void testRegisterAndGet() {
DocumentTypeManager manager = new DocumentTypeManager();
diff --git a/document/src/test/java/com/yahoo/document/datatypes/StringTestCase.java b/document/src/test/java/com/yahoo/document/datatypes/StringTestCase.java
index fd2b4a3982d..ffc372d4851 100644
--- a/document/src/test/java/com/yahoo/document/datatypes/StringTestCase.java
+++ b/document/src/test/java/com/yahoo/document/datatypes/StringTestCase.java
@@ -343,6 +343,7 @@ public class StringTestCase extends AbstractTypesTest {
return document;
}
+ @SuppressWarnings("deprecation")
public Document consume(Document document, DocumentTypeManager docTypeMgr) {
DocumentType type = docTypeMgr.getDocumentType("blog");
Collection<Field> fc = type.getFields();
diff --git a/document/src/test/java/com/yahoo/document/fieldset/FieldSetTestCase.java b/document/src/test/java/com/yahoo/document/fieldset/FieldSetTestCase.java
index e9889d3149e..c11c58ff729 100644
--- a/document/src/test/java/com/yahoo/document/fieldset/FieldSetTestCase.java
+++ b/document/src/test/java/com/yahoo/document/fieldset/FieldSetTestCase.java
@@ -20,6 +20,7 @@ import static org.junit.Assert.assertTrue;
public class FieldSetTestCase extends DocumentTestCaseBase {
@Test
+ @SuppressWarnings("deprecation")
public void testClone() throws Exception {
assertTrue(new AllFields().clone() instanceof AllFields);
assertTrue(new NoFields().clone() instanceof NoFields);
@@ -29,6 +30,7 @@ public class FieldSetTestCase extends DocumentTestCaseBase {
}
@Test
+ @SuppressWarnings("deprecation")
public void testParsing() {
FieldSetRepo repo = new FieldSetRepo();
@@ -65,6 +67,7 @@ public class FieldSetTestCase extends DocumentTestCaseBase {
}
@Test
+ @SuppressWarnings("deprecation")
public void testContains() throws Exception {
Field headerField = testDocType.getField("intattr");
Field bodyField = testDocType.getField("rawattr");
diff --git a/documentgen-test/src/test/java/com/yahoo/vespa/config/DocumentGenPluginTest.java b/documentgen-test/src/test/java/com/yahoo/vespa/config/DocumentGenPluginTest.java
index f5acc267ae8..cc597cbc859 100644
--- a/documentgen-test/src/test/java/com/yahoo/vespa/config/DocumentGenPluginTest.java
+++ b/documentgen-test/src/test/java/com/yahoo/vespa/config/DocumentGenPluginTest.java
@@ -784,6 +784,7 @@ public class DocumentGenPluginTest {
}
@Test
+ @SuppressWarnings("deprecation")
public void testSerialization() {
final Book book = getBook();
assertEquals(book.getMystruct().getD1(), (Double)56.777);
diff --git a/vdslib/src/main/java/com/yahoo/vdslib/DynamicDocumentList.java b/vdslib/src/main/java/com/yahoo/vdslib/DynamicDocumentList.java
index b243f0a3dea..fd627c5839e 100644
--- a/vdslib/src/main/java/com/yahoo/vdslib/DynamicDocumentList.java
+++ b/vdslib/src/main/java/com/yahoo/vdslib/DynamicDocumentList.java
@@ -2,7 +2,12 @@
package com.yahoo.vdslib;
import com.yahoo.compress.CompressionType;
-import com.yahoo.document.*;
+import com.yahoo.document.BucketIdFactory;
+import com.yahoo.document.DataType;
+import com.yahoo.document.Document;
+import com.yahoo.document.DocumentPut;
+import com.yahoo.document.DocumentRemove;
+import com.yahoo.document.DocumentUpdate;
import com.yahoo.document.serialization.DocumentSerializer;
import com.yahoo.document.serialization.DocumentSerializerFactory;
import com.yahoo.vespa.objects.Serializer;
@@ -72,6 +77,7 @@ public class DynamicDocumentList extends DocumentList {
buf.put(null, serializer.getBuf().getByteBuffer());
}
}
+ @SuppressWarnings("deprecation")
private void serializeInternal(DocumentSerializer buf) {
ByteOrder originalOrder = buf.getBuf().order();
buf.getBuf().order(ByteOrder.LITTLE_ENDIAN);
@@ -106,8 +112,8 @@ public class DynamicDocumentList extends DocumentList {
metaEntry.timestamp = lastModified;
}
- if (doc.getDataType().getHeaderType().getCompressionConfig() != null
- && doc.getDataType().getHeaderType().getCompressionConfig().type != CompressionType.NONE) {
+ if (doc.getDataType().getContentType().getCompressionConfig() != null
+ && doc.getDataType().getContentType().getCompressionConfig().type != CompressionType.NONE) {
metaEntry.flags |= MetaEntry.COMPRESSED;
}
if (doc.getDataType().getBodyType().getCompressionConfig() != null
diff --git a/vespa-documentgen-plugin/src/main/java/com/yahoo/vespa/DocumentGenMojo.java b/vespa-documentgen-plugin/src/main/java/com/yahoo/vespa/DocumentGenMojo.java
index d27352b8ea7..7e73d6b5915 100644
--- a/vespa-documentgen-plugin/src/main/java/com/yahoo/vespa/DocumentGenMojo.java
+++ b/vespa-documentgen-plugin/src/main/java/com/yahoo/vespa/DocumentGenMojo.java
@@ -2,7 +2,14 @@
package com.yahoo.vespa;
import com.yahoo.collections.Pair;
-import com.yahoo.document.*;
+import com.yahoo.document.ArrayDataType;
+import com.yahoo.document.DataType;
+import com.yahoo.document.Field;
+import com.yahoo.document.MapDataType;
+import com.yahoo.document.ReferenceDataType;
+import com.yahoo.document.StructDataType;
+import com.yahoo.document.TensorDataType;
+import com.yahoo.document.WeightedSetDataType;
import com.yahoo.document.annotation.AnnotationReferenceDataType;
import com.yahoo.document.annotation.AnnotationType;
import com.yahoo.documentmodel.NewDocumentType;
@@ -11,7 +18,6 @@ import com.yahoo.searchdefinition.Search;
import com.yahoo.searchdefinition.SearchBuilder;
import com.yahoo.searchdefinition.parser.ParseException;
import org.apache.maven.plugin.AbstractMojo;
-import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.Component;
import org.apache.maven.plugins.annotations.LifecyclePhase;
@@ -19,8 +25,20 @@ import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;
-import java.io.*;
-import java.util.*;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
/**
* Goal which generates Vespa document classes from SD files.
@@ -75,7 +93,7 @@ public class DocumentGenMojo extends AbstractMojo {
private Map<String, String> structTypes;
private Map<String, String> annotationTypes;
- void execute(File sdDir, File outputDir, String packageName) throws MojoFailureException {
+ void execute(File sdDir, File outputDir, String packageName) {
if ("".equals(packageName)) throw new IllegalArgumentException("You may not use empty package for generated types.");
searches = new HashMap<>();
docTypes = new HashMap<>();
@@ -99,7 +117,7 @@ public class DocumentGenMojo extends AbstractMojo {
}
exportPackageInfo(outputDir, packageName);
if (annotationsExported) exportPackageInfo(outputDir, packageName+".annotation");
- exportDocFactory(outputDir, builder.getSearchList(), packageName);
+ exportDocFactory(outputDir, packageName);
if (project!=null) project.addCompileSourceRoot(outputDirectory.toString());
}
@@ -166,7 +184,7 @@ public class DocumentGenMojo extends AbstractMojo {
return false;
}
- private void exportDocFactory(File outputDir, List<Search> searches, String packageName) {
+ private void exportDocFactory(File outputDir, String packageName) {
File dirForSources = new File(outputDir, packageName.replaceAll("\\.", "/"));
dirForSources.mkdirs();
File target = new File(dirForSources, "ConcreteDocumentFactory.java");
@@ -338,8 +356,8 @@ public class DocumentGenMojo extends AbstractMojo {
* Handle the case of an annotation reference with a type that is user provided, we need to know the class name then
*/
private String exportImportProvidedAnnotationRefs(AnnotationType annType) {
- String ret = "";
- if (annType.getDataType()==null) return ret;
+ if (annType.getDataType()==null) return "";
+ StringBuilder ret = new StringBuilder();
for (Field f : ((StructDataType)annType.getDataType()).getFields()) {
if (f.getDataType() instanceof AnnotationReferenceDataType) {
AnnotationReferenceDataType refType = (AnnotationReferenceDataType) f.getDataType();
@@ -347,12 +365,11 @@ public class DocumentGenMojo extends AbstractMojo {
String providedClass = provided(referenced.getName());
if (providedClass!=null) {
// Annotationreference is to a type that is user-provided
- ret = ret +
- "import "+providedClass+";\n";
+ ret.append("import ").append(providedClass).append(";\n");
}
}
}
- return ret;
+ return ret.toString();
}
private String annTypeModifier(AnnotationType annType) {
@@ -368,12 +385,12 @@ public class DocumentGenMojo extends AbstractMojo {
}
private static String exportInnerImportsFromSuperTypes(NewDocumentType docType, String packageName) {
- String ret = "";
+ StringBuilder ret = new StringBuilder();
for (NewDocumentType inherited : docType.getInherited()) {
if (inherited.getName().equals("document")) continue;
- ret = ret + "import "+packageName+"."+className(inherited.getName())+".*;\n";
+ ret.append("import ").append(packageName).append(".").append(className(inherited.getName())).append(".*;\n");
}
- return ret;
+ return ret.toString();
}
private String getParentAnnotationType(AnnotationType annType) {
@@ -384,7 +401,7 @@ public class DocumentGenMojo extends AbstractMojo {
return className(annType.getInheritedTypes().iterator().next().getName());
}
- private void exportDocumentSources(File outputDir, NewDocumentType docType, String packageName) throws MojoFailureException {
+ private void exportDocumentSources(File outputDir, NewDocumentType docType, String packageName) {
File dirForSources = new File(outputDir, packageName.replaceAll("\\.", "/"));
dirForSources.mkdirs();
File target = new File(dirForSources, className(docType.getName())+".java");
@@ -444,7 +461,7 @@ public class DocumentGenMojo extends AbstractMojo {
Collection<Field> allUniqueFields = getAllUniqueFields(multiExtends, docType.getAllFields());
exportExtendedStructTypeGetter(className, docType.getName(), allUniqueFields, out, 1, "getDocumentType", "com.yahoo.document.DocumentType");
- exportCopyConstructor(className, allUniqueFields, out, 1, true);
+ exportCopyConstructor(className, out, 1, true);
exportFieldsAndAccessors(className, "com.yahoo.document.Document".equals(superType) ? allUniqueFields : docType.getFields(), out, 1, true);
exportDocumentMethods(allUniqueFields, out, 1);
@@ -513,7 +530,7 @@ public class DocumentGenMojo extends AbstractMojo {
*
* NOTE: This is important, the docproc framework uses that constructor.
*/
- private static void exportCopyConstructor(String className, Collection<Field> fieldSet, Writer out, int ind, boolean docId) throws IOException {
+ private static void exportCopyConstructor(String className, Writer out, int ind, boolean docId) throws IOException {
out.write(
ind(ind)+"/**\n"+
ind(ind)+" * Constructs a "+className+" by taking a deep copy of the provided StructuredFieldValue.\n" +
@@ -587,7 +604,7 @@ public class DocumentGenMojo extends AbstractMojo {
}
private static void exportOverriddenStructGetter(Collection<Field> fields, Writer out, int ind, String methodName, String structType) throws IOException {
- out.write(ind(ind)+"@Override public com.yahoo.document.datatypes.Struct "+methodName+"() {\n" +
+ out.write(ind(ind)+"@Override @Deprecated public com.yahoo.document.datatypes.Struct "+methodName+"() {\n" +
ind(ind+1)+"com.yahoo.document.datatypes.Struct ret = new com.yahoo.document.datatypes.Struct("+structType+");\n");
for (Field f : fields) {
out.write(ind(ind+1)+"ret.setFieldValue(\""+f.getName()+"\", getFieldValue(getField(\""+f.getName()+"\")));\n");
@@ -604,8 +621,8 @@ public class DocumentGenMojo extends AbstractMojo {
exportGetFieldCount(fieldSet, out, ind);
exportGetField(out, ind);
exportGetFieldValue(fieldSet, out, ind);
- exportSetFieldValue(fieldSet, out, ind);
- exportRemoveFieldValue(fieldSet, out, ind);
+ exportSetFieldValue(out, ind);
+ exportRemoveFieldValue(out, ind);
exportIterator(fieldSet, out, ind);
exportClear(fieldSet, out, ind);
@@ -654,7 +671,7 @@ public class DocumentGenMojo extends AbstractMojo {
ind(ind)+"}\n\n");
}
- private static void exportRemoveFieldValue(Collection<Field> fieldSet, Writer out, int ind) throws IOException {
+ private static void exportRemoveFieldValue(Writer out, int ind) throws IOException {
out.write(ind(ind) + "@Override public com.yahoo.document.datatypes.FieldValue removeFieldValue(com.yahoo.document.Field field) {\n");
out.write(ind(ind+1) + "if (field==null) return null;\n");
out.write(ind(ind+1) + "com.yahoo.document.ExtendedField ef = ensureExtended(field);\n");
@@ -662,7 +679,7 @@ public class DocumentGenMojo extends AbstractMojo {
out.write(ind(ind) + "}\n");
}
- private static void exportSetFieldValue(Collection<Field> fieldSet, Writer out, int ind) throws IOException {
+ private static void exportSetFieldValue(Writer out, int ind) throws IOException {
out.write(ind(ind)+"@Override public com.yahoo.document.datatypes.FieldValue setFieldValue(com.yahoo.document.Field field, com.yahoo.document.datatypes.FieldValue value) {\n");
out.write(ind(ind+1)+"com.yahoo.document.ExtendedField ef = ensureExtended(field);\n");
out.write(ind(ind+1)+"return (ef != null) ? ef.setFieldValue(this, value) : super.setFieldValue(field, value);\n");
@@ -721,7 +738,7 @@ public class DocumentGenMojo extends AbstractMojo {
out.write(ind(ind+1)+"public "+structClassName+"() {\n" +
ind(ind+2)+"super("+structClassName+".type);\n" +
ind(ind+1)+"}\n\n");
- exportCopyConstructor(structClassName, structType.getFields(), out, ind+1, false);
+ exportCopyConstructor(structClassName, out, ind+1, false);
exportExtendedStructTypeGetter(structClassName, structType.getName(), structType.getFields(), out, ind+1, "getStructType", "com.yahoo.document.StructDataType");
exportAssign(structType, structClassName, out, ind+1);
exportFieldsAndAccessors(structClassName, structType.getFields(), out, ind+1, true);
@@ -820,7 +837,7 @@ public class DocumentGenMojo extends AbstractMojo {
*/
private static String ind(int levels) {
int indent = levels*STD_INDENT;
- StringBuilder sb = new StringBuilder("");
+ StringBuilder sb = new StringBuilder();
for (int i = 0 ; i<indent ; i++) {
sb.append(" ");
}
@@ -907,15 +924,15 @@ public class DocumentGenMojo extends AbstractMojo {
}
@Override
- public void execute() throws MojoExecutionException, MojoFailureException {
+ public void execute() {
execute(this.sdDirectory, this.outputDirectory, this.packageName);
}
- public Map<String, Search> getSearches() {
+ Map<String, Search> getSearches() {
return searches;
}
private static String upperCaseFirstChar(String s) {
- return s.substring(0, 1).toUpperCase()+s.substring(1, s.length());
+ return s.substring(0, 1).toUpperCase()+s.substring(1);
}
}
diff --git a/vespaclient-container-plugin/src/test/java/com/yahoo/document/restapi/resource/MockedOperationHandler.java b/vespaclient-container-plugin/src/test/java/com/yahoo/document/restapi/resource/MockedOperationHandler.java
index ff968b941a2..fbaa7f86bd0 100644
--- a/vespaclient-container-plugin/src/test/java/com/yahoo/document/restapi/resource/MockedOperationHandler.java
+++ b/vespaclient-container-plugin/src/test/java/com/yahoo/document/restapi/resource/MockedOperationHandler.java
@@ -30,6 +30,7 @@ public class MockedOperationHandler implements OperationHandler {
}
@Override
+ @SuppressWarnings("deprecation")
public void put(RestUri restUri, VespaXMLFeedReader.Operation data, Optional<String> route) throws RestApiException {
log.append("PUT: " + data.getDocument().getId());
log.append(data.getDocument().getBody().toString());