From 72231250ed81e10d66bfe70701e64fa5fe50f712 Mon Sep 17 00:00:00 2001 From: Jon Bratseth Date: Wed, 15 Jun 2016 23:09:44 +0200 Subject: Publish --- .../.gitignore | 2 + vespa_application_maven_archetype_plugin/OWNERS | 1 + vespa_application_maven_archetype_plugin/pom.xml | 42 ++++++++++++++ .../META-INF/maven/archetype-metadata.xml | 33 +++++++++++ .../archetype-resources/components/pom.xml | 57 ++++++++++++++++++ .../src/main/java/ExampleDocumentProcessor.java | 41 +++++++++++++ .../components/src/main/java/ExampleSearcher.java | 31 ++++++++++ .../main/resources/configdefinitions/example.def | 4 ++ .../src/main/resources/archetype-resources/pom.xml | 67 ++++++++++++++++++++++ .../src/main/application/hosts.xml | 7 +++ .../src/main/application/package.json | 7 +++ .../src/main/application/services.xml | 30 ++++++++++ .../resources/projects/basic/archetype.properties | 4 ++ .../src/test/resources/projects/basic/goal.txt | 1 + 14 files changed, 327 insertions(+) create mode 100644 vespa_application_maven_archetype_plugin/.gitignore create mode 100644 vespa_application_maven_archetype_plugin/OWNERS create mode 100644 vespa_application_maven_archetype_plugin/pom.xml create mode 100644 vespa_application_maven_archetype_plugin/src/main/resources/META-INF/maven/archetype-metadata.xml create mode 100644 vespa_application_maven_archetype_plugin/src/main/resources/archetype-resources/components/pom.xml create mode 100644 vespa_application_maven_archetype_plugin/src/main/resources/archetype-resources/components/src/main/java/ExampleDocumentProcessor.java create mode 100644 vespa_application_maven_archetype_plugin/src/main/resources/archetype-resources/components/src/main/java/ExampleSearcher.java create mode 100644 vespa_application_maven_archetype_plugin/src/main/resources/archetype-resources/components/src/main/resources/configdefinitions/example.def create mode 100644 vespa_application_maven_archetype_plugin/src/main/resources/archetype-resources/pom.xml create mode 100644 vespa_application_maven_archetype_plugin/src/main/resources/archetype-resources/src/main/application/hosts.xml create mode 100755 vespa_application_maven_archetype_plugin/src/main/resources/archetype-resources/src/main/application/package.json create mode 100644 vespa_application_maven_archetype_plugin/src/main/resources/archetype-resources/src/main/application/services.xml create mode 100644 vespa_application_maven_archetype_plugin/src/test/resources/projects/basic/archetype.properties create mode 100644 vespa_application_maven_archetype_plugin/src/test/resources/projects/basic/goal.txt (limited to 'vespa_application_maven_archetype_plugin') diff --git a/vespa_application_maven_archetype_plugin/.gitignore b/vespa_application_maven_archetype_plugin/.gitignore new file mode 100644 index 00000000000..12251442258 --- /dev/null +++ b/vespa_application_maven_archetype_plugin/.gitignore @@ -0,0 +1,2 @@ +/target +/pom.xml.build diff --git a/vespa_application_maven_archetype_plugin/OWNERS b/vespa_application_maven_archetype_plugin/OWNERS new file mode 100644 index 00000000000..3b2ba1ede81 --- /dev/null +++ b/vespa_application_maven_archetype_plugin/OWNERS @@ -0,0 +1 @@ +gjoranv diff --git a/vespa_application_maven_archetype_plugin/pom.xml b/vespa_application_maven_archetype_plugin/pom.xml new file mode 100644 index 00000000000..e1c2fb8e89a --- /dev/null +++ b/vespa_application_maven_archetype_plugin/pom.xml @@ -0,0 +1,42 @@ + + + + 4.0.0 + + com.yahoo.vespa + parent + 6-SNAPSHOT + ../parent/pom.xml + + + vespa_application_maven_archetype_plugin + 6-SNAPSHOT + maven-archetype + + + + org.apache.maven.archetype + archetype-packaging + + + + + src/main/resources + true + + archetype-resources/pom.xml + archetype-resources/components/pom.xml + + + + src/main/resources + false + + archetype-resources/components/pom.xml + archetype-resources/pom.xml + + + + + diff --git a/vespa_application_maven_archetype_plugin/src/main/resources/META-INF/maven/archetype-metadata.xml b/vespa_application_maven_archetype_plugin/src/main/resources/META-INF/maven/archetype-metadata.xml new file mode 100644 index 00000000000..6f1abc5ba22 --- /dev/null +++ b/vespa_application_maven_archetype_plugin/src/main/resources/META-INF/maven/archetype-metadata.xml @@ -0,0 +1,33 @@ + + + + + + components/src/main/java + + **/*.java + + + + src/main/application + + **/*.xml + **/*.json + + + + components + + **/*.xml + + + + components/src/main/resources + + **/*.def + + + + diff --git a/vespa_application_maven_archetype_plugin/src/main/resources/archetype-resources/components/pom.xml b/vespa_application_maven_archetype_plugin/src/main/resources/archetype-resources/components/pom.xml new file mode 100644 index 00000000000..ce5e0399434 --- /dev/null +++ b/vespa_application_maven_archetype_plugin/src/main/resources/archetype-resources/components/pom.xml @@ -0,0 +1,57 @@ + + + + 4.0.0 + + + + \${groupId} + \${artifactId} + \${version} + container-plugin + sample container plugin + + Starting point for creating a maven container plugin. + + + + + com.yahoo.vespa + bundle-plugin + ${vespa_version} + true + + + + org.apache.maven.plugins + maven-compiler-plugin + 2.3.2 + + 1.8 + 1.8 + true + + + + + + + + junit + junit + 4.9 + test + + + + com.yahoo.vespa + container-dev + ${vespa_version} + provided + + + + + UTF-8 + + diff --git a/vespa_application_maven_archetype_plugin/src/main/resources/archetype-resources/components/src/main/java/ExampleDocumentProcessor.java b/vespa_application_maven_archetype_plugin/src/main/resources/archetype-resources/components/src/main/java/ExampleDocumentProcessor.java new file mode 100644 index 00000000000..bf18b53909d --- /dev/null +++ b/vespa_application_maven_archetype_plugin/src/main/resources/archetype-resources/components/src/main/java/ExampleDocumentProcessor.java @@ -0,0 +1,41 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package ${package}; + +import com.yahoo.document.*; +import com.yahoo.docproc.*; + +import com.yahoo.example.ExampleConfig; +import com.yahoo.document.datatypes.StringFieldValue; + +/** + * An example document processor. + * + * @author Joe Developer + */ +public class ExampleDocumentProcessor extends DocumentProcessor { + private final String message; + private final String field = "message"; + + public ExampleDocumentProcessor(ExampleConfig config) { + message = config.message(); + } + + + public Progress process(Processing processing) { + for (DocumentOperation op : processing.getDocumentOperations()) { + if (op instanceof DocumentPut) { + DocumentPut put = (DocumentPut) op; + Document document = put.getDocument(); + document.setFieldValue(field, new StringFieldValue(message)); + } else if (base instanceof DocumentUpdate) { + DocumentUpdate update = (DocumentUpdate) base; + //TODO do something to 'update' here + } else if (base instanceof DocumentRemove) { + DocumentRemove remove = (DocumentRemove) base; + //TODO do something to 'remove' here + } + } + return Progress.DONE; + } + +} diff --git a/vespa_application_maven_archetype_plugin/src/main/resources/archetype-resources/components/src/main/java/ExampleSearcher.java b/vespa_application_maven_archetype_plugin/src/main/resources/archetype-resources/components/src/main/java/ExampleSearcher.java new file mode 100644 index 00000000000..2eb27f6d4c9 --- /dev/null +++ b/vespa_application_maven_archetype_plugin/src/main/resources/archetype-resources/components/src/main/java/ExampleSearcher.java @@ -0,0 +1,31 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package ${package}; + +import com.yahoo.search.Query; +import com.yahoo.search.Result; +import com.yahoo.search.Searcher; +import com.yahoo.search.result.Hit; +import com.yahoo.search.searchchain.Execution; +import com.yahoo.example.ExampleConfig; + +/** + * A searcher adding a new hit. + * + * @author Joe Developer + */ +public class ExampleSearcher extends Searcher { + private final String message; + + public ExampleSearcher(ExampleConfig config) { + message = config.message(); + } + + public Result search(Query query,Execution execution) { + Hit hit = new Hit("ExampleHit"); + hit.setField("message", message); + + Result result = execution.search(query); + result.hits().add(hit); + return result; + } +} diff --git a/vespa_application_maven_archetype_plugin/src/main/resources/archetype-resources/components/src/main/resources/configdefinitions/example.def b/vespa_application_maven_archetype_plugin/src/main/resources/archetype-resources/components/src/main/resources/configdefinitions/example.def new file mode 100644 index 00000000000..471f6997ae1 --- /dev/null +++ b/vespa_application_maven_archetype_plugin/src/main/resources/archetype-resources/components/src/main/resources/configdefinitions/example.def @@ -0,0 +1,4 @@ +# Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +version=1 +namespace=example +message string default="Hello, World!" diff --git a/vespa_application_maven_archetype_plugin/src/main/resources/archetype-resources/pom.xml b/vespa_application_maven_archetype_plugin/src/main/resources/archetype-resources/pom.xml new file mode 100644 index 00000000000..214f52880cf --- /dev/null +++ b/vespa_application_maven_archetype_plugin/src/main/resources/archetype-resources/pom.xml @@ -0,0 +1,67 @@ + + + + 4.0.0 + test + test-application + pom + ${vespa_version} + application + + + components + + + + maven2-repository.dev.java.net + http://download.java.net/maven/2 + + false + + + + + + + junit + junit + 4.9 + test + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 2.1 + + 1.8 + 1.8 + true + true + true + -Xlint:unchecked + + + + com.yahoo.vespa + vespa-application-maven-plugin + ${vespa_version} + + + + packageApplication + + + + + + + + + true + UTF-8 + + diff --git a/vespa_application_maven_archetype_plugin/src/main/resources/archetype-resources/src/main/application/hosts.xml b/vespa_application_maven_archetype_plugin/src/main/resources/archetype-resources/src/main/application/hosts.xml new file mode 100644 index 00000000000..3ab86a21aef --- /dev/null +++ b/vespa_application_maven_archetype_plugin/src/main/resources/archetype-resources/src/main/application/hosts.xml @@ -0,0 +1,7 @@ + + + + + node1 + + diff --git a/vespa_application_maven_archetype_plugin/src/main/resources/archetype-resources/src/main/application/package.json b/vespa_application_maven_archetype_plugin/src/main/resources/archetype-resources/src/main/application/package.json new file mode 100755 index 00000000000..aab8330a58c --- /dev/null +++ b/vespa_application_maven_archetype_plugin/src/main/resources/archetype-resources/src/main/application/package.json @@ -0,0 +1,7 @@ +{ + "name": "${artifactId}", + "version": "${version}", + "dependencies": { + "connect": ">=0.2.4" + }, +} diff --git a/vespa_application_maven_archetype_plugin/src/main/resources/archetype-resources/src/main/application/services.xml b/vespa_application_maven_archetype_plugin/src/main/resources/archetype-resources/src/main/application/services.xml new file mode 100644 index 00000000000..a7ffb4446d5 --- /dev/null +++ b/vespa_application_maven_archetype_plugin/src/main/resources/archetype-resources/src/main/application/services.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + Hello, world + + + + + + + + + + diff --git a/vespa_application_maven_archetype_plugin/src/test/resources/projects/basic/archetype.properties b/vespa_application_maven_archetype_plugin/src/test/resources/projects/basic/archetype.properties new file mode 100644 index 00000000000..c4510cfb2cd --- /dev/null +++ b/vespa_application_maven_archetype_plugin/src/test/resources/projects/basic/archetype.properties @@ -0,0 +1,4 @@ +version=6-SNAPSHOT +groupId=com.yahoo.vespa +artifactId=vespa-application-plugin +package=archetype.test \ No newline at end of file diff --git a/vespa_application_maven_archetype_plugin/src/test/resources/projects/basic/goal.txt b/vespa_application_maven_archetype_plugin/src/test/resources/projects/basic/goal.txt new file mode 100644 index 00000000000..1ab1a926ff0 --- /dev/null +++ b/vespa_application_maven_archetype_plugin/src/test/resources/projects/basic/goal.txt @@ -0,0 +1 @@ +Create vespa application along with plugins for vespa container(e.g. searcher, docproc, handler). -- cgit v1.2.3