incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject git commit: Staring to implement a write command and add documentation.
Date Mon, 01 Sep 2014 19:44:39 GMT
Repository: incubator-blur
Updated Branches:
  refs/heads/master b434b067f -> 4d5198e76


Staring to implement a write command and add documentation.


Project: http://git-wip-us.apache.org/repos/asf/incubator-blur/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-blur/commit/4d5198e7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-blur/tree/4d5198e7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-blur/diff/4d5198e7

Branch: refs/heads/master
Commit: 4d5198e767cdc81c5ebd52e0eab3740d7e256a6d
Parents: b434b06
Author: Aaron McCurry <amccurry@gmail.com>
Authored: Mon Sep 1 15:44:10 2014 -0400
Committer: Aaron McCurry <amccurry@gmail.com>
Committed: Mon Sep 1 15:44:10 2014 -0400

----------------------------------------------------------------------
 .../apache/blur/manager/command/Argument.java   | 28 ++++++++++
 .../apache/blur/manager/command/Arguments.java  | 26 ++++++++++
 .../blur/manager/command/IndexWriteCommand.java |  3 --
 .../blur/manager/command/cmds/AddDocument.java  | 54 ++++++++++++++++++++
 4 files changed, 108 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/4d5198e7/blur-core/src/main/java/org/apache/blur/manager/command/Argument.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/manager/command/Argument.java b/blur-core/src/main/java/org/apache/blur/manager/command/Argument.java
new file mode 100644
index 0000000..1da3c7c
--- /dev/null
+++ b/blur-core/src/main/java/org/apache/blur/manager/command/Argument.java
@@ -0,0 +1,28 @@
+package org.apache.blur.manager.command;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Argument {
+  String name();
+
+  String value();
+}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/4d5198e7/blur-core/src/main/java/org/apache/blur/manager/command/Arguments.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/manager/command/Arguments.java b/blur-core/src/main/java/org/apache/blur/manager/command/Arguments.java
new file mode 100644
index 0000000..b08b5c6
--- /dev/null
+++ b/blur-core/src/main/java/org/apache/blur/manager/command/Arguments.java
@@ -0,0 +1,26 @@
+package org.apache.blur.manager.command;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Arguments {
+  Argument[] value();
+}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/4d5198e7/blur-core/src/main/java/org/apache/blur/manager/command/IndexWriteCommand.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/manager/command/IndexWriteCommand.java
b/blur-core/src/main/java/org/apache/blur/manager/command/IndexWriteCommand.java
index 6ebc440..893638b 100644
--- a/blur-core/src/main/java/org/apache/blur/manager/command/IndexWriteCommand.java
+++ b/blur-core/src/main/java/org/apache/blur/manager/command/IndexWriteCommand.java
@@ -18,12 +18,9 @@ package org.apache.blur.manager.command;
 
 import java.io.IOException;
 
-import org.apache.blur.server.TableContext;
 import org.apache.lucene.index.IndexWriter;
 
 public interface IndexWriteCommand<T> {
-  
-  public abstract Shard route(Args args, TableContext context) throws IOException;
 
   public abstract T execute(IndexContext context, IndexWriter writer) throws IOException;
 

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/4d5198e7/blur-core/src/main/java/org/apache/blur/manager/command/cmds/AddDocument.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/manager/command/cmds/AddDocument.java
b/blur-core/src/main/java/org/apache/blur/manager/command/cmds/AddDocument.java
new file mode 100644
index 0000000..5d2a3dd
--- /dev/null
+++ b/blur-core/src/main/java/org/apache/blur/manager/command/cmds/AddDocument.java
@@ -0,0 +1,54 @@
+package org.apache.blur.manager.command.cmds;
+
+import java.io.IOException;
+
+import org.apache.blur.manager.command.Args;
+import org.apache.blur.manager.command.Argument;
+import org.apache.blur.manager.command.Arguments;
+import org.apache.blur.manager.command.IndexContext;
+import org.apache.blur.manager.command.IndexWriteCommand;
+import org.apache.lucene.document.Document;
+import org.apache.lucene.index.IndexWriter;
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+@SuppressWarnings("serial")
+@Arguments({
+    @Argument(name = "shard", value = "The shard id that the addDocument command is to be
applied."),
+    @Argument(name = "doc", value = "Is a map of string key to string values that will be
converted"
+        + "into a Lucene Document via the FieldManager and added to the index.") })
+public class AddDocument extends BaseCommand implements IndexWriteCommand<Void> {
+
+  @Override
+  public String getName() {
+    return "addDoc";
+  }
+
+  @Override
+  public Void execute(IndexContext context, IndexWriter writer) throws IOException {
+    Args args = context.getArgs();
+    Document doc = getDoc(args);
+    writer.addDocument(doc);
+    return null;
+  }
+
+  private Document getDoc(Args args) {
+    throw new RuntimeException("Not Implemented");
+  }
+
+}


Mime
View raw message