POLYGENE-29 - Updating docs and putting the doc support code in place.
Project: http://git-wip-us.apache.org/repos/asf/polygene-java/repo Commit: http://git-wip-us.apache.org/repos/asf/polygene-java/commit/11a9d3d4 Tree: http://git-wip-us.apache.org/repos/asf/polygene-java/tree/11a9d3d4 Diff: http://git-wip-us.apache.org/repos/asf/polygene-java/diff/11a9d3d4 Branch: refs/heads/develop Commit: 11a9d3d4d29d7551c810e6c971a1a5a18c85e1aa Parents: 71aaa07 Author: niclas <[email protected]> Authored: Sun Apr 9 12:32:51 2017 +0800 Committer: niclas <[email protected]> Committed: Sun Apr 9 12:32:51 2017 +0800 ---------------------------------------------------------------------- libraries/scripting/src/docs/groovy.txt | 10 ++--- libraries/scripting/src/docs/javascript.txt | 6 +-- libraries/scripting/src/docs/scripting.txt | 46 ++++++++++---------- .../library/scripting/HelloSpeakerMixin.groovy | 31 +++++++++++++ .../library/scripting/HelloSpeaker.java | 4 +- .../library/scripting/HelloSpeakerMixin.groovy | 31 ------------- .../library/scripting/HelloSpeakerTest.java | 5 +-- .../library/scripting/ScriptMixinTest.java | 2 - .../library/scripting/HelloSpeaker.groovy | 2 +- 9 files changed, 67 insertions(+), 70 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/polygene-java/blob/11a9d3d4/libraries/scripting/src/docs/groovy.txt ---------------------------------------------------------------------- diff --git a/libraries/scripting/src/docs/groovy.txt b/libraries/scripting/src/docs/groovy.txt index a277bc3..c60850c 100644 --- a/libraries/scripting/src/docs/groovy.txt +++ b/libraries/scripting/src/docs/groovy.txt @@ -32,7 +32,7 @@ All examples below are based on this type: [snippet,java] ---- -source=libraries/lang-groovy/src/test/groovy/org/apache/polygene/library/groovy/HelloSpeaker.java +source=libraries/scripting/src/test/java/org/apache/polygene/library/scripting/HelloSpeaker.java tag=speaker ---- @@ -45,7 +45,7 @@ Having this Groovy class compiled ; .HelloSpeakerMixin.groovy [snippet,groovy] ---- -source=libraries/lang-groovy/src/test/groovy/org/apache/polygene/library/groovy/HelloSpeakerMixin.groovy +source=libraries/scripting/src/test/groovy/org/apache/polygene/library/scripting/HelloSpeakerMixin.groovy tag=direct ---- @@ -53,7 +53,7 @@ assemble it directly: [snippet,java] ---- -source=libraries/lang-groovy/src/test/groovy/org/apache/polygene/library/groovy/HelloSpeakerTest.java +source=libraries/scripting/src/test/java/org/apache/polygene/library/scripting/HelloSpeakerTest.java tag=direct ---- @@ -64,7 +64,7 @@ Declare a Groovy function in a resource file located in the same package as the .HelloSpeaker.groovy [snippet,groovy] ---- -source=libraries/lang-groovy/src/test/resources/org/apache/polygene/library/groovy/HelloSpeaker.groovy +source=libraries/scripting/src/test/resources/org/apache/polygene/library/scripting/HelloSpeaker.groovy tag=script ---- @@ -72,6 +72,6 @@ Then assemble it with the normal +ScriptMixin+: [snippet,java] ---- -source=libraries/lang-groovy/src/test/groovy/org/apache/polygene/library/groovy/HelloSpeakerTest.java +source=libraries/scripting/src/test/java/org/apache/polygene/library/scripting/HelloSpeakerTest.java tag=script ---- http://git-wip-us.apache.org/repos/asf/polygene-java/blob/11a9d3d4/libraries/scripting/src/docs/javascript.txt ---------------------------------------------------------------------- diff --git a/libraries/scripting/src/docs/javascript.txt b/libraries/scripting/src/docs/javascript.txt index 7568dfb..b5f3714 100644 --- a/libraries/scripting/src/docs/javascript.txt +++ b/libraries/scripting/src/docs/javascript.txt @@ -26,8 +26,8 @@ For the following Polygene composite type, [snippet,java] ---- -source=libraries/scripting/src/test/java/org/apache/polygene/library/javascript/HelloSpeaker.java -tag=mixin +source=libraries/scripting/src/test/java/org/apache/polygene/library/scripting/HelloSpeaker.java +tag=speaker ---- @@ -35,7 +35,7 @@ we need a implementation that looks like this; [snippet,javascript] ---- -source=libraries/scripting/src/test/java/org/apache/polygene/library/scripting/HelloSpeaker.js +source=libraries/scripting/src/test/resources/org/apache/polygene/library/scripting/HelloSpeaker.js tag=script ---- http://git-wip-us.apache.org/repos/asf/polygene-java/blob/11a9d3d4/libraries/scripting/src/docs/scripting.txt ---------------------------------------------------------------------- diff --git a/libraries/scripting/src/docs/scripting.txt b/libraries/scripting/src/docs/scripting.txt index 5ae5099..1dc0cdf 100644 --- a/libraries/scripting/src/docs/scripting.txt +++ b/libraries/scripting/src/docs/scripting.txt @@ -51,12 +51,12 @@ We welcome additional information and samples of languages that has been tried a .Language Support [options="header"] |======= -| Language | Supported | Tested | Implementation -| JavaScript | Yes | Yes | | Nashorn, built-in Java 8 and later +| Language | Supported | Tested | License | Implementation +| JavaScript | Yes | Yes | ? | Nashorn, built-in Java 8 and later | Groovy | Yes | Yes | Apache | Apache Groovy, dependency exist from this library -| Ruby | Yes | No | | JRuby -| Python | Yes | No | | Jython, must use jython-standalone -| Kotlin | Yes | No | | Jetbrains +| Ruby | Yes | No | (EPL|GPL|LGPL) + Ruby | JRuby +| Python | Yes | No | https://opensource.org/licenses/Python-2.0[Python] | Jython, must use jython-standalone +| Kotlin | Yes | No | Apache | Jetbrains | Lua | Yes | No | MIT | luaj.org, | Clojure | Yes | No | CPL | https://github.com/pmf/clojure-jsr223 |======= @@ -67,24 +67,24 @@ The following languages may or may not be supported, and was found at https://ja [options="header"] |======= | Language | Location | License -|beanshell -|ejs -|freemarker -|jacl -|jaskell -|jawk -|jelly -|jep -|jexl -|jst -|judo -|juel -|ognl -|pnuts -|scheme -|velocity -|xpath -|xslt +|beanshell | | +|ejs | | +|freemarker | https://freemarker.apache.org | Apache +|jacl | | +|jaskell | https://github.com/MarchLiu/jaskell | MIT +|jawk | | +|jelly | | Apache +|jep | | +|jexl | https://commons.apache.org/jexl/ | Apache +|jst | | +|judo | | +|juel | | +|ognl | https://commons.apache.org/ognl/ | Apache +|pnuts | | +|scheme | http://sisc-scheme.org/ | (MPLv1.1|GPLv2) +|velocity | https://velocity.apache.org | Apache +|xpath | | +|xslt | | |======= .Not Compatible Languages http://git-wip-us.apache.org/repos/asf/polygene-java/blob/11a9d3d4/libraries/scripting/src/test/groovy/org/apache/polygene/library/scripting/HelloSpeakerMixin.groovy ---------------------------------------------------------------------- diff --git a/libraries/scripting/src/test/groovy/org/apache/polygene/library/scripting/HelloSpeakerMixin.groovy b/libraries/scripting/src/test/groovy/org/apache/polygene/library/scripting/HelloSpeakerMixin.groovy new file mode 100644 index 0000000..ad3113b --- /dev/null +++ b/libraries/scripting/src/test/groovy/org/apache/polygene/library/scripting/HelloSpeakerMixin.groovy @@ -0,0 +1,31 @@ +/* + * 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. + * + * + */ +package org.apache.polygene.library.scripting; + +// START SNIPPET: direct +class HelloSpeakerMixin + implements HelloSpeaker +{ + + String sayHello() { + "Hello there, Groovy" + } +} +// END SNIPPET: direct http://git-wip-us.apache.org/repos/asf/polygene-java/blob/11a9d3d4/libraries/scripting/src/test/java/org/apache/polygene/library/scripting/HelloSpeaker.java ---------------------------------------------------------------------- diff --git a/libraries/scripting/src/test/java/org/apache/polygene/library/scripting/HelloSpeaker.java b/libraries/scripting/src/test/java/org/apache/polygene/library/scripting/HelloSpeaker.java index 967332b..101d7e9 100644 --- a/libraries/scripting/src/test/java/org/apache/polygene/library/scripting/HelloSpeaker.java +++ b/libraries/scripting/src/test/java/org/apache/polygene/library/scripting/HelloSpeaker.java @@ -21,11 +21,11 @@ package org.apache.polygene.library.scripting; import org.apache.polygene.api.mixin.Mixins; -// START SNIPPET: mixin +// START SNIPPET: speaker @Mixins(ScriptMixin.class) public interface HelloSpeaker { String sayHello(); } -// END SNIPPET: mixin +// END SNIPPET: speaker http://git-wip-us.apache.org/repos/asf/polygene-java/blob/11a9d3d4/libraries/scripting/src/test/java/org/apache/polygene/library/scripting/HelloSpeakerMixin.groovy ---------------------------------------------------------------------- diff --git a/libraries/scripting/src/test/java/org/apache/polygene/library/scripting/HelloSpeakerMixin.groovy b/libraries/scripting/src/test/java/org/apache/polygene/library/scripting/HelloSpeakerMixin.groovy deleted file mode 100644 index ad3113b..0000000 --- a/libraries/scripting/src/test/java/org/apache/polygene/library/scripting/HelloSpeakerMixin.groovy +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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. - * - * - */ -package org.apache.polygene.library.scripting; - -// START SNIPPET: direct -class HelloSpeakerMixin - implements HelloSpeaker -{ - - String sayHello() { - "Hello there, Groovy" - } -} -// END SNIPPET: direct http://git-wip-us.apache.org/repos/asf/polygene-java/blob/11a9d3d4/libraries/scripting/src/test/java/org/apache/polygene/library/scripting/HelloSpeakerTest.java ---------------------------------------------------------------------- diff --git a/libraries/scripting/src/test/java/org/apache/polygene/library/scripting/HelloSpeakerTest.java b/libraries/scripting/src/test/java/org/apache/polygene/library/scripting/HelloSpeakerTest.java index de03c4c..6ae5436 100644 --- a/libraries/scripting/src/test/java/org/apache/polygene/library/scripting/HelloSpeakerTest.java +++ b/libraries/scripting/src/test/java/org/apache/polygene/library/scripting/HelloSpeakerTest.java @@ -19,7 +19,6 @@ */ package org.apache.polygene.library.scripting; -import org.junit.Assert; import org.junit.Test; import org.apache.polygene.bootstrap.AssemblyException; import org.apache.polygene.bootstrap.ModuleAssembly; @@ -47,10 +46,10 @@ public class HelloSpeakerTest extends AbstractPolygeneTest public void assemble( ModuleAssembly module ) throws AssemblyException { - module.transients( HelloSpeaker.class ).setMetaInfo( Scripting.GROOVY ).withMixins( ScriptMixin.class ); + module.values( HelloSpeaker.class ).setMetaInfo( Scripting.GROOVY ).withMixins( ScriptMixin.class ); } }; - HelloSpeaker speaker = assembler.module().newTransient( HelloSpeaker.class ); + HelloSpeaker speaker = assembler.module().newValue( HelloSpeaker.class ); assertThat( speaker.sayHello(), equalTo("Hello, Groovy") ); // END SNIPPET: script } http://git-wip-us.apache.org/repos/asf/polygene-java/blob/11a9d3d4/libraries/scripting/src/test/java/org/apache/polygene/library/scripting/ScriptMixinTest.java ---------------------------------------------------------------------- diff --git a/libraries/scripting/src/test/java/org/apache/polygene/library/scripting/ScriptMixinTest.java b/libraries/scripting/src/test/java/org/apache/polygene/library/scripting/ScriptMixinTest.java index 75b6085..df51580 100644 --- a/libraries/scripting/src/test/java/org/apache/polygene/library/scripting/ScriptMixinTest.java +++ b/libraries/scripting/src/test/java/org/apache/polygene/library/scripting/ScriptMixinTest.java @@ -33,8 +33,6 @@ import org.apache.polygene.api.value.ValueBuilderFactory; import org.apache.polygene.bootstrap.AssemblyException; import org.apache.polygene.bootstrap.LayerAssembly; import org.apache.polygene.bootstrap.ModuleAssembly; -import org.apache.polygene.runtime.structure.LayerModel; -import org.apache.polygene.runtime.structure.ModuleModel; import org.apache.polygene.test.AbstractPolygeneTest; import org.junit.Test; http://git-wip-us.apache.org/repos/asf/polygene-java/blob/11a9d3d4/libraries/scripting/src/test/resources/org/apache/polygene/library/scripting/HelloSpeaker.groovy ---------------------------------------------------------------------- diff --git a/libraries/scripting/src/test/resources/org/apache/polygene/library/scripting/HelloSpeaker.groovy b/libraries/scripting/src/test/resources/org/apache/polygene/library/scripting/HelloSpeaker.groovy index 1c0b7a8..69e5cfe 100644 --- a/libraries/scripting/src/test/resources/org/apache/polygene/library/scripting/HelloSpeaker.groovy +++ b/libraries/scripting/src/test/resources/org/apache/polygene/library/scripting/HelloSpeaker.groovy @@ -17,7 +17,7 @@ * * */ -package org.apache.polygene.library.groovy +package org.apache.polygene.library.scripting // START SNIPPET: script def sayHello() {
