Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

stupid doc hack

  • Loading branch information...
commit db835dfcefefeade0e000d79ced164861d9d916c 1 parent aeb491e
Dave Parfitt authored

Showing 26 changed files with 260 additions and 72 deletions. Show diff stats Hide diff stats

  1. +126 21 README.md
  2. +6 0 pom.xml
  3. +0 24 src/main/java/com/basho/contact/Contact.java
  4. +1 0  src/main/java/com/basho/contact/actions/Binding.java
  5. +1 9 src/main/java/com/basho/contact/actions/ContactActionListener.java
  6. +1 6 src/main/java/com/basho/contact/actions/JSActionListener.java
  7. +1 0  src/main/java/com/basho/contact/commands/ConnectCommand.java
  8. +1 0  src/main/java/com/basho/contact/commands/DeleteCommand.java
  9. +1 0  src/main/java/com/basho/contact/commands/FetchCommand.java
  10. +1 0  src/main/java/com/basho/contact/commands/GetBucketPropsCommand.java
  11. +1 0  src/main/java/com/basho/contact/commands/ListBucketsCommand.java
  12. +1 0  src/main/java/com/basho/contact/commands/ListKeysCommand.java
  13. +1 0  src/main/java/com/basho/contact/commands/MapredCommand.java
  14. +1 0  src/main/java/com/basho/contact/commands/Query2iCommand.java
  15. +1 0  src/main/java/com/basho/contact/commands/StoreCommand.java
  16. +3 3 src/main/java/com/basho/contact/commands/{ → params}/ConnectParams.java
  17. +1 1  src/main/java/com/basho/contact/commands/{ → params}/DeleteParams.java
  18. +1 1  src/main/java/com/basho/contact/commands/{ → params}/FetchParams.java
  19. +104 0 src/main/java/com/basho/contact/commands/params/GenDocs.java
  20. +1 1  src/main/java/com/basho/contact/commands/{ → params}/GetBucketPropsParams.java
  21. +1 1  src/main/java/com/basho/contact/commands/{ → params}/ListBucketsParams.java
  22. +1 1  src/main/java/com/basho/contact/commands/{ → params}/ListKeysParams.java
  23. +1 1  src/main/java/com/basho/contact/commands/{ → params}/MapRedParams.java
  24. +1 1  src/main/java/com/basho/contact/commands/{ → params}/Query2iParams.java
  25. +1 1  src/main/java/com/basho/contact/commands/{ → params}/SetBucketPropsParams.java
  26. +1 1  src/main/java/com/basho/contact/commands/{ → params}/StoreParams.java
147 README.md
Source Rendered
@@ -348,33 +348,138 @@ Dave Parfitt
348 348 Address:
349 349 1000 Big Nosk drive
350 350 Buffalo, NY 14222
351   ->```
  351 +```
352 352
353 353 The key function in the postfetch action above is `JSON.parse(v)`, which turns evaluates a string and returns a Javascript object.
354 354
355 355 I hope to have a "Cookbook" section on the Contact wiki eventually, but in the meantime, you can check out the [Javadocs for the Riak Java Client](http://basho.github.com/riak-java-client/1.1.0/index.html) for available methods.
356 356
357 357
358   -####Available actions:
359   - * preconnect
360   - * postconnect
361   - * prefetch
362   - * postfetch
363   - * prestore
364   - * poststore
365   - * predelete
366   - * postdelete
367   - * prequery2i
368   - * postquery2i
369   - * premapred
370   - * postmapred
371   - * prelistbuckets
372   - * postlistbuckets
373   - * prelistkeys
374   - * postlistkeys
375   - * pregetbucketprops
376   - * postgetbucketprops
377   -
  358 +####Available actions
  359 +
  360 +* **listkeys**
  361 + * **Pre** parameters
  362 + * options : *[java.util.Map](http://docs.oracle.com/javase/7/docs/api/java/util/Map.html)<[java.lang.String](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html), [java.lang.Object](http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html)>*
  363 + * contact : *[com.basho.contact.RuntimeContext]()*
  364 + * bucket : *[java.lang.String](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html)*
  365 + * **Post** parameters
  366 + * options : *[java.util.Map](http://docs.oracle.com/javase/7/docs/api/java/util/Map.html)<[java.lang.String](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html), [java.lang.Object](http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html)>*
  367 + * contact : *[com.basho.contact.RuntimeContext]()*
  368 + * keys : *[java.util.List](http://docs.oracle.com/javase/7/docs/api/java/util/List.html)<[java.lang.String](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html)>*
  369 + * bucket : *[java.lang.String](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html)*
  370 +
  371 +* **fetch**
  372 + * **Pre** parameters
  373 + * fetchObj : *[com.basho.riak.client.operations.FetchObject](http://basho.github.com/riak-java-client/1.1.0/com/basho/riak/client/operations/FetchObject.html)<[com.basho.riak.client.IRiakObject](http://basho.github.com/riak-java-client/1.1.0/com/basho/riak/client/IRiakObject.html)>*
  374 + * options : *[java.util.Map](http://docs.oracle.com/javase/7/docs/api/java/util/Map.html)<[java.lang.String](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html), [java.lang.Object](http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html)>*
  375 + * contact : *[com.basho.contact.RuntimeContext]()*
  376 + * bucket : *[java.lang.String](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html)*
  377 + * key : *[java.lang.String](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html)*
  378 + * **Post** parameters
  379 + * key : *[java.lang.String](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html)*
  380 + * options : *[java.util.Map](http://docs.oracle.com/javase/7/docs/api/java/util/Map.html)<[java.lang.String](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html), [java.lang.Object](http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html)>*
  381 + * contact : *[com.basho.contact.RuntimeContext]()*
  382 + * riak_object : *[com.basho.riak.client.IRiakObject](http://basho.github.com/riak-java-client/1.1.0/com/basho/riak/client/IRiakObject.html)*
  383 + * bucket : *[java.lang.String](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html)*
  384 +
  385 +* **mapred**
  386 + * **Pre** parameters
  387 + * options : *[java.util.Map](http://docs.oracle.com/javase/7/docs/api/java/util/Map.html)<[java.lang.String](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html), [java.lang.Object](http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html)>*
  388 + * contact : *[com.basho.contact.RuntimeContext]()*
  389 + * bucket : *[java.lang.String](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html)*
  390 + * **Post** parameters
  391 + * options : *[java.util.Map](http://docs.oracle.com/javase/7/docs/api/java/util/Map.html)<[java.lang.String](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html), [java.lang.Object](http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html)>*
  392 + * contact : *[com.basho.contact.RuntimeContext]()*
  393 + * bucket : *[java.lang.String](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html)*
  394 +
  395 +* **connect**
  396 + * **Pre** parameters
  397 + * options : *[java.util.Map](http://docs.oracle.com/javase/7/docs/api/java/util/Map.html)<[java.lang.String](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html), [java.lang.Object](http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html)>*
  398 + * contact : *[com.basho.contact.RuntimeContext]()*
  399 + * riak_host : *[java.lang.String](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html)*
  400 + * bucket : *[java.lang.String](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html)*
  401 + * riak_pb_port : *[int]()*
  402 + * **Post** parameters
  403 + * riak_pb_port : *[int]()*
  404 + * options : *[java.util.Map](http://docs.oracle.com/javase/7/docs/api/java/util/Map.html)<[java.lang.String](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html), [java.lang.Object](http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html)>*
  405 + * contact : *[com.basho.contact.RuntimeContext]()*
  406 + * bucket : *[java.lang.String](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html)*
  407 + * riak_client : *[com.basho.riak.client.IRiakClient](http://basho.github.com/riak-java-client/1.1.0/com/basho/riak/client/IRiakClient.html)*
  408 + * riak_host : *[java.lang.String](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html)*
  409 +
  410 +* **store**
  411 + * **Pre** parameters
  412 + * options : *[java.util.Map](http://docs.oracle.com/javase/7/docs/api/java/util/Map.html)<[java.lang.String](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html), [java.lang.Object](http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html)>*
  413 + * indexes : *[java.util.List](http://docs.oracle.com/javase/7/docs/api/java/util/List.html)<[com.basho.contact.Pair](http://basho.github.com/riak-java-client/1.1.0/com/basho/contact/Pair.html)>*
  414 + * key : *[java.lang.String](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html)*
  415 + * contact : *[com.basho.contact.RuntimeContext]()*
  416 + * bucket : *[java.lang.String](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html)*
  417 + * content : *[com.basho.contact.Content](http://basho.github.com/riak-java-client/1.1.0/com/basho/contact/Content.html)*
  418 + * **Post** parameters
  419 + * options : *[java.util.Map](http://docs.oracle.com/javase/7/docs/api/java/util/Map.html)<[java.lang.String](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html), [java.lang.Object](http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html)>*
  420 + * contact : *[com.basho.contact.RuntimeContext]()*
  421 + * bucket : *[java.lang.String](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html)*
  422 + * riak_object : *[com.basho.riak.client.IRiakObject](http://basho.github.com/riak-java-client/1.1.0/com/basho/riak/client/IRiakObject.html)*
  423 +
  424 +* **setbucketprops**
  425 + * **Pre** parameters
  426 + * options : *[java.util.Map](http://docs.oracle.com/javase/7/docs/api/java/util/Map.html)<[java.lang.String](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html), [java.lang.Object](http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html)>*
  427 + * contact : *[com.basho.contact.RuntimeContext]()*
  428 + * bucket : *[java.lang.String](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html)*
  429 + * **Post** parameters
  430 + * options : *[java.util.Map](http://docs.oracle.com/javase/7/docs/api/java/util/Map.html)<[java.lang.String](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html), [java.lang.Object](http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html)>*
  431 + * contact : *[com.basho.contact.RuntimeContext]()*
  432 + * bucket : *[java.lang.String](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html)*
  433 +
  434 +* **getbucketprops**
  435 + * **Pre** parameters
  436 + * options : *[java.util.Map](http://docs.oracle.com/javase/7/docs/api/java/util/Map.html)<[java.lang.String](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html), [java.lang.Object](http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html)>*
  437 + * contact : *[com.basho.contact.RuntimeContext]()*
  438 + * bucket : *[java.lang.String](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html)*
  439 + * **Post** parameters
  440 + * options : *[java.util.Map](http://docs.oracle.com/javase/7/docs/api/java/util/Map.html)<[java.lang.String](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html), [java.lang.Object](http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html)>*
  441 + * contact : *[com.basho.contact.RuntimeContext]()*
  442 + * bucket : *[java.lang.String](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html)*
  443 +
  444 +* **delete**
  445 + * **Pre** parameters
  446 + * options : *[java.util.Map](http://docs.oracle.com/javase/7/docs/api/java/util/Map.html)<[java.lang.String](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html), [java.lang.Object](http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html)>*
  447 + * contact : *[com.basho.contact.RuntimeContext]()*
  448 + * bucket : *[java.lang.String](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html)*
  449 + * **Post** parameters
  450 + * options : *[java.util.Map](http://docs.oracle.com/javase/7/docs/api/java/util/Map.html)<[java.lang.String](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html), [java.lang.Object](http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html)>*
  451 + * contact : *[com.basho.contact.RuntimeContext]()*
  452 + * bucket : *[java.lang.String](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html)*
  453 +
  454 +* **query2i**
  455 + * **Pre** parameters
  456 + * options : *[java.util.Map](http://docs.oracle.com/javase/7/docs/api/java/util/Map.html)<[java.lang.String](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html), [java.lang.Object](http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html)>*
  457 + * index_max : *[java.lang.String](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html)*
  458 + * contact : *[com.basho.contact.RuntimeContext]()*
  459 + * index_min : *[java.lang.String](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html)*
  460 + * index_val : *[java.lang.String](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html)*
  461 + * bucket : *[java.lang.String](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html)*
  462 + * index_name : *[java.lang.String](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html)*
  463 + * **Post** parameters
  464 + * options : *[java.util.Map](http://docs.oracle.com/javase/7/docs/api/java/util/Map.html)<[java.lang.String](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html), [java.lang.Object](http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html)>*
  465 + * index_name : *[java.lang.String](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html)*
  466 + * index_val : *[java.lang.String](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html)*
  467 + * contact : *[com.basho.contact.RuntimeContext]()*
  468 + * index_max : *[java.lang.String](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html)*
  469 + * bucket : *[java.lang.String](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html)*
  470 + * index_min : *[java.lang.String](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html)*
  471 + * results : *[java.util.List](http://docs.oracle.com/javase/7/docs/api/java/util/List.html)<?>*
  472 +
  473 +* **listbuckets**
  474 + * **Pre** parameters
  475 + * options : *[java.util.Map](http://docs.oracle.com/javase/7/docs/api/java/util/Map.html)<[java.lang.String](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html), [java.lang.Object](http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html)>*
  476 + * contact : *[com.basho.contact.RuntimeContext]()*
  477 + * bucket : *[java.lang.String](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html)*
  478 + * **Post** parameters
  479 + * options : *[java.util.Map](http://docs.oracle.com/javase/7/docs/api/java/util/Map.html)<[java.lang.String](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html), [java.lang.Object](http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html)>*
  480 + * buckets : *[java.util.Set](http://docs.oracle.com/javase/7/docs/api/java/util/Set.html)<[java.lang.String](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html)>*
  481 + * contact : *[com.basho.contact.RuntimeContext]()*
  482 + * bucket : *[java.lang.String](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html)*
378 483
379 484
380 485
6 pom.xml
@@ -66,6 +66,12 @@
66 66 <version>3.8.2</version>
67 67 <scope>test</scope>
68 68 </dependency>
  69 + <dependency>
  70 + <groupId>org.reflections</groupId>
  71 + <artifactId>reflections</artifactId>
  72 + <version>0.9.8</version>
  73 + </dependency>
  74 +
69 75 </dependencies>
70 76 <build>
71 77 <plugins>
24 src/main/java/com/basho/contact/Contact.java
... ... @@ -1,24 +0,0 @@
1   -package com.basho.contact;
2   -
3   -
4   -public class Contact {
5   -// public static void main(String[] args) throws Exception {
6   -// ANTLRInputStream input = new ANTLRInputStream(System.in);
7   -// ContactLexer lexer = new ContactLexer(input);
8   -// CommonTokenStream tokens = new CommonTokenStream(lexer);
9   -// ContactParser parser = new ContactParser(tokens);
10   -// RuntimeContext ctx = new RuntimeContext();
11   -// parser.addErrorListener(new ContactErrorListener(ctx));
12   -// ParseTreeWalker walker = new ParseTreeWalker();
13   -//
14   -//
15   -// ContactWalker cw = new ContactWalker(ctx);
16   -// ContactMapredWalker mapredcw = new ContactMapredWalker(ctx);
17   -//
18   -// ProgContext pc = parser.prog();
19   -// walker.walk(cw, pc);
20   -// walker.walk(mapredcw, pc);
21   -//
22   -// System.out.println("Done!");
23   -// }
24   -}
1  src/main/java/com/basho/contact/actions/Binding.java
@@ -10,4 +10,5 @@
10 10 public @interface Binding {
11 11 String name() default "";
12 12 boolean copy() default true;
  13 + boolean javadoc() default false;
13 14 }
10 src/main/java/com/basho/contact/actions/ContactActionListener.java
... ... @@ -1,14 +1,6 @@
1 1 package com.basho.contact.actions;
2 2
3   -import java.util.List;
4   -import java.util.Map;
5   -import java.util.Set;
6   -
7   -import com.basho.contact.commands.*;
8   -import com.basho.riak.client.IRiakClient;
9   -import com.basho.riak.client.IRiakObject;
10   -import com.basho.riak.client.operations.StoreObject;
11   -import com.basho.riak.client.query.indexes.FetchIndex;
  3 +import com.basho.contact.commands.params.*;
12 4
13 5 public interface ContactActionListener{
14 6 public void init();
7 src/main/java/com/basho/contact/actions/JSActionListener.java
@@ -3,20 +3,15 @@
3 3 import java.io.PrintStream;
4 4 import java.lang.reflect.Field;
5 5 import java.util.HashMap;
6   -import java.util.List;
7 6 import java.util.Map;
8 7 import java.util.Set;
9 8
10   -import com.basho.contact.commands.*;
  9 +import com.basho.contact.commands.params.*;
11 10 import org.mozilla.javascript.Context;
12 11 import org.mozilla.javascript.Scriptable;
13 12 import org.mozilla.javascript.ScriptableObject;
14 13
15 14 import com.basho.contact.RuntimeContext;
16   -import com.basho.riak.client.IRiakClient;
17   -import com.basho.riak.client.IRiakObject;
18   -import com.basho.riak.client.operations.StoreObject;
19   -import com.basho.riak.client.query.indexes.FetchIndex;
20 15
21 16 public class JSActionListener implements ContactActionListener {
22 17
1  src/main/java/com/basho/contact/commands/ConnectCommand.java
@@ -2,6 +2,7 @@
2 2
3 3 import com.basho.contact.RiakCommand;
4 4 import com.basho.contact.RuntimeContext;
  5 +import com.basho.contact.commands.params.ConnectParams;
5 6 import com.basho.contact.symbols.ConnectionSymbol;
6 7 import com.basho.riak.client.IRiakClient;
7 8
1  src/main/java/com/basho/contact/commands/DeleteCommand.java
@@ -2,6 +2,7 @@
2 2
3 3 import com.basho.contact.RiakCommand;
4 4 import com.basho.contact.RuntimeContext;
  5 +import com.basho.contact.commands.params.DeleteParams;
5 6 import com.basho.contact.symbols.ResultSymbol;
6 7
7 8 public class DeleteCommand extends RiakCommand<ResultSymbol, DeleteParams.Pre> {
1  src/main/java/com/basho/contact/commands/FetchCommand.java
@@ -5,6 +5,7 @@
5 5
6 6 import com.basho.contact.RiakCommand;
7 7 import com.basho.contact.RuntimeContext;
  8 +import com.basho.contact.commands.params.FetchParams;
8 9 import com.basho.contact.symbols.ResultSymbol;
9 10 import com.basho.riak.client.IRiakClient;
10 11 import com.basho.riak.client.IRiakObject;
1  src/main/java/com/basho/contact/commands/GetBucketPropsCommand.java
@@ -2,6 +2,7 @@
2 2
3 3 import com.basho.contact.RiakCommand;
4 4 import com.basho.contact.RuntimeContext;
  5 +import com.basho.contact.commands.params.GetBucketPropsParams;
5 6 import com.basho.contact.symbols.ResultSymbol;
6 7
7 8 public class GetBucketPropsCommand extends RiakCommand<ResultSymbol, GetBucketPropsParams.Pre> {
1  src/main/java/com/basho/contact/commands/ListBucketsCommand.java
@@ -4,6 +4,7 @@
4 4
5 5 import com.basho.contact.RiakCommand;
6 6 import com.basho.contact.RuntimeContext;
  7 +import com.basho.contact.commands.params.ListBucketsParams;
7 8 import com.basho.contact.symbols.ResultSymbol;
8 9 import com.basho.riak.client.RiakException;
9 10
1  src/main/java/com/basho/contact/commands/ListKeysCommand.java
@@ -5,6 +5,7 @@
5 5
6 6 import com.basho.contact.RiakCommand;
7 7 import com.basho.contact.RuntimeContext;
  8 +import com.basho.contact.commands.params.ListKeysParams;
8 9 import com.basho.contact.symbols.ResultSymbol;
9 10 import com.basho.riak.client.IRiakClient;
10 11 import com.basho.riak.client.RiakException;
1  src/main/java/com/basho/contact/commands/MapredCommand.java
@@ -2,6 +2,7 @@
2 2
3 3 import com.basho.contact.RiakCommand;
4 4 import com.basho.contact.RuntimeContext;
  5 +import com.basho.contact.commands.params.MapRedParams;
5 6 import com.basho.contact.symbols.ResultsSymbol;
6 7
7 8 public class MapredCommand extends RiakCommand<ResultsSymbol, MapRedParams.Pre> {
1  src/main/java/com/basho/contact/commands/Query2iCommand.java
@@ -2,6 +2,7 @@
2 2
3 3 import com.basho.contact.RiakCommand;
4 4 import com.basho.contact.RuntimeContext;
  5 +import com.basho.contact.commands.params.Query2iParams;
5 6 import com.basho.contact.symbols.Query2IResultsSymbol;
6 7 import com.basho.riak.client.IRiakClient;
7 8 import com.basho.riak.client.RiakException;
1  src/main/java/com/basho/contact/commands/StoreCommand.java
@@ -6,6 +6,7 @@
6 6 import com.basho.contact.Pair;
7 7 import com.basho.contact.RiakCommand;
8 8 import com.basho.contact.RuntimeContext;
  9 +import com.basho.contact.commands.params.StoreParams;
9 10 import com.basho.contact.symbols.ResultSymbol;
10 11 import com.basho.riak.client.IRiakClient;
11 12 import com.basho.riak.client.IRiakObject;
6 ...ava/com/basho/contact/commands/ConnectParams.java → .../basho/contact/commands/params/ConnectParams.java
... ... @@ -1,4 +1,4 @@
1   -package com.basho.contact.commands;
  1 +package com.basho.contact.commands.params;
2 2
3 3
4 4 import com.basho.contact.actions.ActionParams;
@@ -19,7 +19,7 @@
19 19 public String host;
20 20 @Binding(name = "riak_pb_port")
21 21 public int pbPort;
22   - @Binding(name = "riak_client")
23   - IRiakClient client;
  22 + @Binding(name = "riak_client", javadoc = true)
  23 + public IRiakClient client;
24 24 }
25 25 }
2  ...java/com/basho/contact/commands/DeleteParams.java → ...m/basho/contact/commands/params/DeleteParams.java
... ... @@ -1,4 +1,4 @@
1   -package com.basho.contact.commands;
  1 +package com.basho.contact.commands.params;
2 2
3 3 import com.basho.contact.actions.ActionParams;
4 4
2  .../java/com/basho/contact/commands/FetchParams.java → ...om/basho/contact/commands/params/FetchParams.java
... ... @@ -1,4 +1,4 @@
1   -package com.basho.contact.commands;
  1 +package com.basho.contact.commands.params;
2 2
3 3
4 4 import com.basho.contact.actions.ActionParams;
104 src/main/java/com/basho/contact/commands/params/GenDocs.java
... ... @@ -0,0 +1,104 @@
  1 +package com.basho.contact.commands.params;
  2 +
  3 +import com.basho.contact.actions.ActionParams;
  4 +import com.basho.contact.actions.Binding;
  5 +import com.google.common.base.Predicate;
  6 +import org.reflections.ReflectionUtils;
  7 +import org.reflections.Reflections;
  8 +import static org.reflections.Reflections.*;
  9 +import javax.annotation.Nullable;
  10 +import java.lang.reflect.Field;
  11 +import java.util.*;
  12 +import java.util.regex.Matcher;
  13 +import java.util.regex.Pattern;
  14 +
  15 +public class GenDocs {
  16 + //http://basho.github.com/riak-java-client/1.1.0/com/basho/riak/client/IRiakClient.html
  17 + public static class Doc {
  18 + public Doc(String id) {
  19 + this.id = id;
  20 + }
  21 +
  22 + public Doc(String id, String clazz) {
  23 + this.id = id;
  24 + this.clazz = clazz;
  25 + }
  26 + String id;
  27 + String clazz;
  28 + List<Doc> pres = new ArrayList<Doc>();
  29 + List<Doc> posts = new ArrayList<Doc>();
  30 + }
  31 +
  32 + public static String linkifyClasses(String s) {
  33 + if(s.startsWith("class")) {
  34 + s = s.substring(6);
  35 + } else if(s.startsWith("interface")) {
  36 + s = s.substring(10);
  37 + }
  38 + Pattern p = Pattern.compile("([\\p{L}_$][\\p{L}\\p{N}_$]*\\.)*[\\p{L}_$][\\p{L}\\p{N}_$]*");
  39 + Matcher m = p.matcher(s);
  40 +
  41 + StringBuffer docString = new StringBuffer();
  42 + while(m.find()) {
  43 + String classname = m.group();
  44 + String url = "";
  45 + if(classname.startsWith("java")) {
  46 + // http://docs.oracle.com/javase/7/docs/api/java/lang/String.html
  47 + url = "http://docs.oracle.com/javase/7/docs/api/" + classname.replace(".", "/") + ".html";
  48 + } else if(classname.startsWith("com.basho")) {
  49 + if(!classname.endsWith("RuntimeContext")) {
  50 + url = "http://basho.github.com/riak-java-client/1.1.0/" + classname.replace(".", "/") + ".html";
  51 + }
  52 + }
  53 + String data = "[" + s.substring(m.start(), m.end()) + "]("+url+")";
  54 + // [example](http://url.com/ "Title")
  55 + m.appendReplacement(docString, data);
  56 + }
  57 + m.appendTail(docString);
  58 + return docString.toString();
  59 + }
  60 + public static void main(String args[]) {
  61 + //linkifyClasses("java.util.Map<java.lang.String, java.lang.Object>");
  62 + //linkifyClasses("class com.basho.contact.RuntimeContext");
  63 + //linkifyClasses("interface com.basho.riak.client.IRiakObject");
  64 + Reflections reflections = new Reflections("com.basho.contact.commands.params");
  65 + Map<String, Doc> params = new HashMap<String, Doc>();
  66 + Set<Class<? extends ActionParams>> subTypes =
  67 + reflections.getSubTypesOf(ActionParams.class);
  68 + for(Class<? extends ActionParams> c : subTypes) {
  69 + Set<Field> fields = ReflectionUtils.getAllFields(c, withAnnotation(Binding.class));
  70 + for(Field f : fields) {
  71 + String cname = c.getName().substring(c.getName().lastIndexOf(".")+1);
  72 + String xname = c.getEnclosingClass().getName().substring(c.getEnclosingClass().getName().lastIndexOf(".")+1).toLowerCase();
  73 + String name = xname.substring(0, xname.indexOf("params"));
  74 + if(!params.containsKey(name)) {
  75 + params.put(name, new Doc(name));
  76 + }
  77 + Doc doc = params.get(name);
  78 + Binding b = f.getAnnotation(Binding.class);
  79 + Doc item = new Doc(b.name(), f.getGenericType().toString());
  80 + if(cname.endsWith("Pre")) {
  81 + doc.pres.add(item);
  82 + } else {
  83 + Doc post = new Doc(b.name());
  84 + doc.posts.add(item);
  85 + }
  86 + //System.out.println(cname + ":" + );
  87 + //params.put(cname, f.getName());
  88 + }
  89 + }
  90 + for(String k : params.keySet()) {
  91 + System.out.println("* **" + k + "**");
  92 + System.out.println(" * **Pre** parameters");
  93 + for(Doc d : params.get(k).pres) {
  94 + System.out.println(" * " + d.id + " : *" + linkifyClasses(d.clazz) + "*");
  95 + }
  96 + System.out.println(" * **Post** parameters");
  97 + for(Doc d : params.get(k).posts) {
  98 + System.out.println(" * " + d.id + " : *" + linkifyClasses(d.clazz) + "*");
  99 + }
  100 + System.out.println("");
  101 + }
  102 + }
  103 +
  104 +}
2  .../basho/contact/commands/GetBucketPropsParams.java → ...contact/commands/params/GetBucketPropsParams.java
... ... @@ -1,4 +1,4 @@
1   -package com.basho.contact.commands;
  1 +package com.basho.contact.commands.params;
2 2
3 3 import com.basho.contact.actions.ActionParams;
4 4
2  ...com/basho/contact/commands/ListBucketsParams.java → ...ho/contact/commands/params/ListBucketsParams.java
... ... @@ -1,4 +1,4 @@
1   -package com.basho.contact.commands;
  1 +package com.basho.contact.commands.params;
2 2
3 3 import com.basho.contact.actions.ActionParams;
4 4 import com.basho.contact.actions.Binding;
2  ...va/com/basho/contact/commands/ListKeysParams.java → ...basho/contact/commands/params/ListKeysParams.java
... ... @@ -1,4 +1,4 @@
1   -package com.basho.contact.commands;
  1 +package com.basho.contact.commands.params;
2 2
3 3 import com.basho.contact.actions.ActionParams;
4 4 import com.basho.contact.actions.Binding;
2  ...java/com/basho/contact/commands/MapRedParams.java → ...m/basho/contact/commands/params/MapRedParams.java
... ... @@ -1,4 +1,4 @@
1   -package com.basho.contact.commands;
  1 +package com.basho.contact.commands.params;
2 2
3 3 import com.basho.contact.actions.ActionParams;
4 4
2  ...ava/com/basho/contact/commands/Query2iParams.java → .../basho/contact/commands/params/Query2iParams.java
... ... @@ -1,4 +1,4 @@
1   -package com.basho.contact.commands;
  1 +package com.basho.contact.commands.params;
2 2
3 3
4 4 import com.basho.contact.actions.ActionParams;
2  .../basho/contact/commands/SetBucketPropsParams.java → ...contact/commands/params/SetBucketPropsParams.java
... ... @@ -1,4 +1,4 @@
1   -package com.basho.contact.commands;
  1 +package com.basho.contact.commands.params;
2 2
3 3 import com.basho.contact.actions.ActionParams;
4 4
2  .../java/com/basho/contact/commands/StoreParams.java → ...om/basho/contact/commands/params/StoreParams.java
... ... @@ -1,4 +1,4 @@
1   -package com.basho.contact.commands;
  1 +package com.basho.contact.commands.params;
2 2
3 3 import com.basho.contact.Content;
4 4 import com.basho.contact.Pair;

0 comments on commit db835df

Please sign in to comment.
Something went wrong with that request. Please try again.