polygene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nic...@apache.org
Subject [05/28] zest-qi4j git commit: Adding documentation to the Javascript Scripting Library.
Date Fri, 17 Apr 2015 16:42:44 GMT
Adding documentation to the Javascript Scripting Library.


Project: http://git-wip-us.apache.org/repos/asf/zest-qi4j/repo
Commit: http://git-wip-us.apache.org/repos/asf/zest-qi4j/commit/beb9f687
Tree: http://git-wip-us.apache.org/repos/asf/zest-qi4j/tree/beb9f687
Diff: http://git-wip-us.apache.org/repos/asf/zest-qi4j/diff/beb9f687

Branch: refs/heads/develop
Commit: beb9f68770f5f19315676a0b3a1fe263276e5607
Parents: c78eaf3
Author: Niclas Hedhman <niclas@hedhman.org>
Authored: Sat Jan 10 19:09:33 2015 +0800
Committer: Niclas Hedhman <niclas@hedhman.org>
Committed: Sat Jan 10 19:09:33 2015 +0800

----------------------------------------------------------------------
 libraries/lang-javascript/dev-status.xml        |  2 +-
 .../src/docs/lang-javascript.txt                | 18 ++++++++++--
 .../qi4j/lang/javascript/JavaScriptMixin.java   |  1 +
 .../lang/javascript/DocumentationSupport.java   | 29 ++++++++++++++++++++
 .../lang/javascript/JavaScriptMixinTest.java    |  2 +-
 libraries/neo4j/dev-status.xml                  |  2 +-
 6 files changed, 48 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/beb9f687/libraries/lang-javascript/dev-status.xml
----------------------------------------------------------------------
diff --git a/libraries/lang-javascript/dev-status.xml b/libraries/lang-javascript/dev-status.xml
index 654d3aa..cefc98a 100644
--- a/libraries/lang-javascript/dev-status.xml
+++ b/libraries/lang-javascript/dev-status.xml
@@ -8,7 +8,7 @@
     <codebase>beta</codebase>
 
     <!-- none, brief, good, complete -->
-    <documentation>none</documentation>
+    <documentation>brief</documentation>
 
     <!-- none, some, good, complete -->
     <unittests>some</unittests>

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/beb9f687/libraries/lang-javascript/src/docs/lang-javascript.txt
----------------------------------------------------------------------
diff --git a/libraries/lang-javascript/src/docs/lang-javascript.txt b/libraries/lang-javascript/src/docs/lang-javascript.txt
index bacd23f..3fb9908 100644
--- a/libraries/lang-javascript/src/docs/lang-javascript.txt
+++ b/libraries/lang-javascript/src/docs/lang-javascript.txt
@@ -6,8 +6,20 @@
 source=libraries/lang-javascript/dev-status.xml
 --------------
 
-Javascript Scripting Library
-
-NOTE: This Library has no documentation yet. Learn how to contribute in <<community-docs>>.
+The Javascript Scripting Library allows Mixin methods to be implemented in Javascript and
loaded dynamically on first use.
 
 include::../../build/docs/buildinfo/artifact.txt[]
+
+The Javascript Scripting Library is a Generic mixin class that implements Composite interfaces
by delegating to JavaScript functions using Rhino. Each method in an interface is declared
as a JS function in a file located in classpath with the name "<interface>.<method>.js",
where the interface name includes the package, and has "." replaced with "/".
+
+Example: org/qi4j/samples/hello/domain/HelloWorldSpeaker.say.js
+
+That means that the HelloWorldSpeaker.say.js file may be co-located with the class files
in the same package. It is currently not supported to place the Javascript implementation
of the mixin in a different package than the interface it implements.
+
+To use Javascript to implement the Mixin functionality for a given interface, simply declare
the +JavaScriptMixin+ like any other mixin, either in the interface or at assembly time.
+
+[snippet,java]
+----
+source=libraries/lang-javascript/src/test/java/org/qi4j/library/lang/javascript/DocumentationSupport.java
+tag=mixin
+----

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/beb9f687/libraries/lang-javascript/src/main/java/org/qi4j/lang/javascript/JavaScriptMixin.java
----------------------------------------------------------------------
diff --git a/libraries/lang-javascript/src/main/java/org/qi4j/lang/javascript/JavaScriptMixin.java
b/libraries/lang-javascript/src/main/java/org/qi4j/lang/javascript/JavaScriptMixin.java
index f924f89..098aaca 100644
--- a/libraries/lang-javascript/src/main/java/org/qi4j/lang/javascript/JavaScriptMixin.java
+++ b/libraries/lang-javascript/src/main/java/org/qi4j/lang/javascript/JavaScriptMixin.java
@@ -51,6 +51,7 @@ public class JavaScriptMixin
 
     @Structure private TransientBuilderFactory factory;
     private Scriptable instanceScope;
+    
     static
     {
         Context cx = Context.enter();

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/beb9f687/libraries/lang-javascript/src/test/java/org/qi4j/lang/javascript/DocumentationSupport.java
----------------------------------------------------------------------
diff --git a/libraries/lang-javascript/src/test/java/org/qi4j/lang/javascript/DocumentationSupport.java
b/libraries/lang-javascript/src/test/java/org/qi4j/lang/javascript/DocumentationSupport.java
new file mode 100644
index 0000000..36aa9f4
--- /dev/null
+++ b/libraries/lang-javascript/src/test/java/org/qi4j/lang/javascript/DocumentationSupport.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2007 Rickard Öberg
+ * Licensed 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.
+*/
+package org.qi4j.lang.javascript;
+
+import org.qi4j.api.mixin.Mixins;
+
+// START SNIPPET: mixin
+import org.qi4j.lang.javascript.JavaScriptMixin;
+// END SNIPPET: mixin
+
+public interface DocumentationSupport
+{
+    // START SNIPPET: mixin
+    @Mixins(JavaScriptMixin.class)
+    public interface HelloSpeaker
+    {
+	void sayHello();
+    }
+    // END SNIPPET: mixin
+}

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/beb9f687/libraries/lang-javascript/src/test/java/org/qi4j/lang/javascript/JavaScriptMixinTest.java
----------------------------------------------------------------------
diff --git a/libraries/lang-javascript/src/test/java/org/qi4j/lang/javascript/JavaScriptMixinTest.java
b/libraries/lang-javascript/src/test/java/org/qi4j/lang/javascript/JavaScriptMixinTest.java
index 4e2e6e4..dc34d91 100644
--- a/libraries/lang-javascript/src/test/java/org/qi4j/lang/javascript/JavaScriptMixinTest.java
+++ b/libraries/lang-javascript/src/test/java/org/qi4j/lang/javascript/JavaScriptMixinTest.java
@@ -1,4 +1,3 @@
-package org.qi4j.lang.javascript;
 /*
  * Copyright 2007 Rickard Öberg
  * Licensed under the Apache License, Version 2.0 (the "License"); 
@@ -10,6 +9,7 @@ package org.qi4j.lang.javascript;
  * See the License for the specific language governing permissions and 
  * limitations under the License.
 */
+package org.qi4j.lang.javascript;
 
 import org.junit.Assert;
 import org.junit.Test;

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/beb9f687/libraries/neo4j/dev-status.xml
----------------------------------------------------------------------
diff --git a/libraries/neo4j/dev-status.xml b/libraries/neo4j/dev-status.xml
index e69e744..26a1204 100644
--- a/libraries/neo4j/dev-status.xml
+++ b/libraries/neo4j/dev-status.xml
@@ -8,7 +8,7 @@
         <codebase>beta</codebase>
 
         <!-- none, brief, good, complete -->
-        <documentation>none</documentation>
+        <documentation>brief</documentation>
 
         <!-- none, some, good, complete -->
         <unittests>some</unittests>


Mime
View raw message