Repository: zest-java Updated Branches: refs/heads/develop 3e86de34e -> d4b6bc9bb
ZEST-50 : Of course the Bootstrap documentation can't have a dependency on core/runtime. Project: http://git-wip-us.apache.org/repos/asf/zest-java/repo Commit: http://git-wip-us.apache.org/repos/asf/zest-java/commit/d4b6bc9b Tree: http://git-wip-us.apache.org/repos/asf/zest-java/tree/d4b6bc9b Diff: http://git-wip-us.apache.org/repos/asf/zest-java/diff/d4b6bc9b Branch: refs/heads/develop Commit: d4b6bc9bbfd318952aa779fb0c65b657a817bf6c Parents: 3e86de3 Author: Niclas Hedhman <[email protected]> Authored: Thu Apr 21 08:56:49 2016 +0800 Committer: Niclas Hedhman <[email protected]> Committed: Thu Apr 21 08:56:49 2016 +0800 ---------------------------------------------------------------------- core/bootstrap/src/docs/bootstrap.txt | 17 ----- .../zest/bootstrap/DocumentationSupport.java | 54 -------------- core/runtime/src/docs/runtime.txt | 21 +++++- .../zest/bootstrap/DocumentationSupport.java | 75 ++++++++++++++++++++ 4 files changed, 95 insertions(+), 72 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/zest-java/blob/d4b6bc9b/core/bootstrap/src/docs/bootstrap.txt ---------------------------------------------------------------------- diff --git a/core/bootstrap/src/docs/bootstrap.txt b/core/bootstrap/src/docs/bootstrap.txt index 7ea2c30..4273b9a 100644 --- a/core/bootstrap/src/docs/bootstrap.txt +++ b/core/bootstrap/src/docs/bootstrap.txt @@ -289,20 +289,3 @@ source=core/bootstrap/src/test/java/org/apache/zest/bootstrap/DocumentationSuppo tag=full -------------- -== Custom AssemblyHelper == -There are rare cases, where a custom AssemblyHelper might be needed. One known use-case is tp introduce an alternative -bytecode generation algorithm, either better than the one we have, or for a different system, such as Dalvik. - -To do this, add the +AssemblyHelper+ implementation instance as +metaInfo+ to the +ApplicationAssembly+ - -We think this is so rare, that the +AssemblyHelper+ class will remain in the +core/runtime+ module and has not -been promoted to the +core/bootstrap+ module. If you plan to use this feature, please contact the Zest development -team at [email protected]+ to ensure we can make this a better supported, backed by real usecases. - -Fictitious example of using a hypothetical Dalvik capable classloader; - -[source,java] --------------- -source=core/bootstrap/src/test/java/org/apache/zest/bootstrap/DocumentationSupport.java -tag=customAssemblyHelper --------------- http://git-wip-us.apache.org/repos/asf/zest-java/blob/d4b6bc9b/core/bootstrap/src/test/java/org/apache/zest/bootstrap/DocumentationSupport.java ---------------------------------------------------------------------- diff --git a/core/bootstrap/src/test/java/org/apache/zest/bootstrap/DocumentationSupport.java b/core/bootstrap/src/test/java/org/apache/zest/bootstrap/DocumentationSupport.java index 51ead3b..497b7c3 100644 --- a/core/bootstrap/src/test/java/org/apache/zest/bootstrap/DocumentationSupport.java +++ b/core/bootstrap/src/test/java/org/apache/zest/bootstrap/DocumentationSupport.java @@ -28,8 +28,6 @@ import org.apache.zest.api.service.importer.NewObjectImporter; import org.apache.zest.api.structure.Application; import org.apache.zest.api.structure.ApplicationDescriptor; import org.apache.zest.api.structure.Module; -import org.apache.zest.runtime.bootstrap.AssemblyHelper; -import org.apache.zest.runtime.composite.FragmentClassLoader; @SuppressWarnings( "ALL" ) public class DocumentationSupport @@ -441,56 +439,4 @@ public class DocumentationSupport } - public static class DalvikAssembly - { - // START SNIPPET: customAssemblyHelper - private static Energy4Java zest; - - private static Application application; - - public static void main( String[] args ) - throws Exception - { - // Create a Zest Runtime - zest = new Energy4Java(); - application = zest.newApplication( new ApplicationAssembler() - { - - @Override - public ApplicationAssembly assemble( ApplicationAssemblyFactory appFactory ) - throws AssemblyException - { - ApplicationAssembly assembly = appFactory.newApplicationAssembly(); - assembly.setMetaInfo( new DalvikAssemblyHelper() ); - // END SNIPPET: customAssemblyHelper - // START SNIPPET: customAssemblyHelper - return assembly; - } - } ); - // activate the application - application.activate(); - } - - - public static class DalvikAssemblyHelper extends AssemblyHelper - { - @Override - protected FragmentClassLoader instantiateFragmentClassLoader( ClassLoader parent ) - { - return new DalvikFragmentClassLoader(parent); - } - } - - public static class DalvikFragmentClassLoader extends FragmentClassLoader - { - - public DalvikFragmentClassLoader( ClassLoader parent ) - { - super( parent ); - } - - } - // END SNIPPET: customAssemblyHelper - } - } http://git-wip-us.apache.org/repos/asf/zest-java/blob/d4b6bc9b/core/runtime/src/docs/runtime.txt ---------------------------------------------------------------------- diff --git a/core/runtime/src/docs/runtime.txt b/core/runtime/src/docs/runtime.txt index 2b8f85a..e9f525d 100644 --- a/core/runtime/src/docs/runtime.txt +++ b/core/runtime/src/docs/runtime.txt @@ -31,4 +31,23 @@ perhaps that a new Core SPI Extension is needed. include::../../build/docs/buildinfo/artifact.txt[] Let's repeat that; *Never, never, ever depend on Core Runtime*. Make sure that the compile dependency does NOT include -the `org.apache.zest.core.runtime` jar. \ No newline at end of file +the `org.apache.zest.core.runtime` jar. + +== Custom AssemblyHelper == +BUT, there are super-rare cases, where a custom AssemblyHelper might be needed. One known use-case is tp introduce +an alternative bytecode generation algorithm, either better than the one we have, or for a different system, such +as Dalvik. + +To do this, add the +AssemblyHelper+ implementation instance as +metaInfo+ to the +ApplicationAssembly+ + +We think this is so rare, that the +AssemblyHelper+ class will remain in the +core/runtime+ module and has not +been promoted to the +core/bootstrap+ module. If you plan to use this feature, please contact the Zest development +team at [email protected]+ to ensure we can make this a better supported, backed by real usecases. + +Fictitious example of using a hypothetical Dalvik capable classloader; + +[source,java] +-------------- +source=core/runtime/src/test/java/org/apache/zest/bootstrap/DocumentationSupport.java +tag=customAssemblyHelper +-------------- http://git-wip-us.apache.org/repos/asf/zest-java/blob/d4b6bc9b/core/runtime/src/test/java/org/apache/zest/bootstrap/DocumentationSupport.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/zest/bootstrap/DocumentationSupport.java b/core/runtime/src/test/java/org/apache/zest/bootstrap/DocumentationSupport.java new file mode 100644 index 0000000..8e17961 --- /dev/null +++ b/core/runtime/src/test/java/org/apache/zest/bootstrap/DocumentationSupport.java @@ -0,0 +1,75 @@ +/* + * 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.zest.bootstrap; + +import org.apache.zest.api.structure.Application; +import org.apache.zest.runtime.bootstrap.AssemblyHelper; +import org.apache.zest.runtime.composite.FragmentClassLoader; + +public class DocumentationSupport +{ + // START SNIPPET: customAssemblyHelper + private static Energy4Java zest; + + private static Application application; + + public static void main( String[] args ) + throws Exception + { + // Create a Zest Runtime + zest = new Energy4Java(); + application = zest.newApplication( new ApplicationAssembler() + { + + @Override + public ApplicationAssembly assemble( ApplicationAssemblyFactory appFactory ) + throws AssemblyException + { + ApplicationAssembly assembly = appFactory.newApplicationAssembly(); + assembly.setMetaInfo( new DalvikAssemblyHelper() ); + // END SNIPPET: customAssemblyHelper + // START SNIPPET: customAssemblyHelper + return assembly; + } + } ); + // activate the application + application.activate(); + } + + public static class DalvikAssemblyHelper extends AssemblyHelper + { + @Override + protected FragmentClassLoader instantiateFragmentClassLoader( ClassLoader parent ) + { + return new DalvikFragmentClassLoader( parent ); + } + } + + public static class DalvikFragmentClassLoader extends FragmentClassLoader + { + + public DalvikFragmentClassLoader( ClassLoader parent ) + { + super( parent ); + } + } + // END SNIPPET: customAssemblyHelper +}
