http://git-wip-us.apache.org/repos/asf/polygene-java/blob/c3175b92/tools/generator-polygene/app/templates/JacksonSerializationModule/bootstrap.tmpl ---------------------------------------------------------------------- diff --git a/tools/generator-polygene/app/templates/JacksonSerializationModule/bootstrap.tmpl b/tools/generator-polygene/app/templates/JacksonSerializationModule/bootstrap.tmpl deleted file mode 100644 index afc0439..0000000 --- a/tools/generator-polygene/app/templates/JacksonSerializationModule/bootstrap.tmpl +++ /dev/null @@ -1,43 +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 <%= packageName %>.bootstrap.infrastructure; - -import org.apache.polygene.api.common.Visibility; -import org.apache.polygene.bootstrap.AssemblyException; -import org.apache.polygene.bootstrap.LayerAssembly; -import org.apache.polygene.bootstrap.ModuleAssembly; -import org.apache.polygene.bootstrap.layered.ModuleAssembler; -import org.apache.polygene.valueserialization.jackson.JacksonValueSerializationAssembler; - -public class JacksonSerializationModule - implements ModuleAssembler -{ - public static final String NAME = "Jackson Serialization Module"; - - @Override - public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module ) - throws AssemblyException - { - new JacksonValueSerializationAssembler() - .visibleIn( Visibility.application ) - .assemble( module ); - return module; - } -}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/c3175b92/tools/generator-polygene/app/templates/JavaxJsonSerializationModule/bootstrap.tmpl ---------------------------------------------------------------------- diff --git a/tools/generator-polygene/app/templates/JavaxJsonSerializationModule/bootstrap.tmpl b/tools/generator-polygene/app/templates/JavaxJsonSerializationModule/bootstrap.tmpl new file mode 100644 index 0000000..6d4a93c --- /dev/null +++ b/tools/generator-polygene/app/templates/JavaxJsonSerializationModule/bootstrap.tmpl @@ -0,0 +1,39 @@ +<%# + * 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 <%= packageName %>.bootstrap.infrastructure; + +import org.apache.polygene.api.common.Visibility; +import org.apache.polygene.bootstrap.AssemblyException; +import org.apache.polygene.bootstrap.LayerAssembly; +import org.apache.polygene.bootstrap.ModuleAssembly; +import org.apache.polygene.bootstrap.layered.ModuleAssembler; + +public class JavaxJsonSerializationModule + implements ModuleAssembler +{ + public static final String NAME = "javax.json Serialization Module"; + + @Override + public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module ) + throws AssemblyException + { + return module; + } +} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/c3175b92/tools/generator-polygene/app/templates/buildtool/gradle-bootstrap.tmpl ---------------------------------------------------------------------- diff --git a/tools/generator-polygene/app/templates/buildtool/gradle-bootstrap.tmpl b/tools/generator-polygene/app/templates/buildtool/gradle-bootstrap.tmpl index d13cb96..464d52e 100644 --- a/tools/generator-polygene/app/templates/buildtool/gradle-bootstrap.tmpl +++ b/tools/generator-polygene/app/templates/buildtool/gradle-bootstrap.tmpl @@ -31,6 +31,6 @@ dependencies { <% } %> compile "org.apache.polygene.extension:org.apache.polygene.extension.entitystore-<%= polygene.entitystore.toLowerCase() %>:$polygeneVersion" compile "org.apache.polygene.extension:org.apache.polygene.extension.indexing-<%= polygene.indexing.toLowerCase() %>:$polygeneVersion" - compile "org.apache.polygene.extension:org.apache.polygene.extension.valueserialization-<%= polygene.serialization.toLowerCase() %>:$polygeneVersion" + compile "org.apache.polygene.extension:org.apache.polygene.extension.serialization-<%= polygene.serialization.toLowerCase() %>:$polygeneVersion" -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/c3175b92/tools/model-detail/src/test/java/org/apache/polygene/tools/model/VisitableDetailTest.java ---------------------------------------------------------------------- diff --git a/tools/model-detail/src/test/java/org/apache/polygene/tools/model/VisitableDetailTest.java b/tools/model-detail/src/test/java/org/apache/polygene/tools/model/VisitableDetailTest.java index d6af619..d06bc96 100644 --- a/tools/model-detail/src/test/java/org/apache/polygene/tools/model/VisitableDetailTest.java +++ b/tools/model-detail/src/test/java/org/apache/polygene/tools/model/VisitableDetailTest.java @@ -22,6 +22,7 @@ package org.apache.polygene.tools.model; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import org.apache.polygene.api.service.ServiceActivation; import org.apache.polygene.tools.model.descriptor.ServiceDetailDescriptor; import org.apache.polygene.tools.model.descriptor.TransientDetailDescriptor; import org.junit.Test; @@ -82,6 +83,7 @@ public class VisitableDetailTest // Module "visitEnter( ModuleName )", "visit( " + ModuleActivator.class.getName() + " )", + "visit( " + ServiceActivation.ServiceActivator.class.getName() + " )", // Leaving Structure "visitLeave( ModuleName )", "visitLeave( LayerName )", http://git-wip-us.apache.org/repos/asf/polygene-java/blob/c3175b92/tools/shell/src/dist/etc/templates/default/files/bootstrap/build.gradle_ ---------------------------------------------------------------------- diff --git a/tools/shell/src/dist/etc/templates/default/files/bootstrap/build.gradle_ b/tools/shell/src/dist/etc/templates/default/files/bootstrap/build.gradle_ new file mode 100644 index 0000000..cb24601 --- /dev/null +++ b/tools/shell/src/dist/etc/templates/default/files/bootstrap/build.gradle_ @@ -0,0 +1,15 @@ + +dependencies { + compile project( ":model" ) + compile project( ":rest" ) + + compile "org.apache.polygene.core:org.apache.polygene.core.spi:$polygeneVersion" + compile "org.apache.polygene.core:org.apache.polygene.core.bootstrap:$polygeneVersion" + + + compile "org.apache.polygene.library:org.apache.polygene.library.fileconfig:$polygeneVersion" + compile "org.apache.polygene.library:org.apache.polygene.library.restlet:$polygeneVersion" + compile "org.apache.polygene.extension:org.apache.polygene.extension.entitystore-file:$polygeneVersion" + compile "org.apache.polygene.extension:org.apache.polygene.extension.indexing-rdf:$polygeneVersion" + +} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/c3175b92/tools/shell/src/dist/etc/templates/ng2-heroes/files/bootstrap/build.gradle_ ---------------------------------------------------------------------- diff --git a/tools/shell/src/dist/etc/templates/ng2-heroes/files/bootstrap/build.gradle_ b/tools/shell/src/dist/etc/templates/ng2-heroes/files/bootstrap/build.gradle_ new file mode 100644 index 0000000..cb24601 --- /dev/null +++ b/tools/shell/src/dist/etc/templates/ng2-heroes/files/bootstrap/build.gradle_ @@ -0,0 +1,15 @@ + +dependencies { + compile project( ":model" ) + compile project( ":rest" ) + + compile "org.apache.polygene.core:org.apache.polygene.core.spi:$polygeneVersion" + compile "org.apache.polygene.core:org.apache.polygene.core.bootstrap:$polygeneVersion" + + + compile "org.apache.polygene.library:org.apache.polygene.library.fileconfig:$polygeneVersion" + compile "org.apache.polygene.library:org.apache.polygene.library.restlet:$polygeneVersion" + compile "org.apache.polygene.extension:org.apache.polygene.extension.entitystore-file:$polygeneVersion" + compile "org.apache.polygene.extension:org.apache.polygene.extension.indexing-rdf:$polygeneVersion" + +} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/c3175b92/tools/shell/src/dist/etc/templates/restapp/files/bootstrap/build.gradle_ ---------------------------------------------------------------------- diff --git a/tools/shell/src/dist/etc/templates/restapp/files/bootstrap/build.gradle_ b/tools/shell/src/dist/etc/templates/restapp/files/bootstrap/build.gradle_ new file mode 100644 index 0000000..cb24601 --- /dev/null +++ b/tools/shell/src/dist/etc/templates/restapp/files/bootstrap/build.gradle_ @@ -0,0 +1,15 @@ + +dependencies { + compile project( ":model" ) + compile project( ":rest" ) + + compile "org.apache.polygene.core:org.apache.polygene.core.spi:$polygeneVersion" + compile "org.apache.polygene.core:org.apache.polygene.core.bootstrap:$polygeneVersion" + + + compile "org.apache.polygene.library:org.apache.polygene.library.fileconfig:$polygeneVersion" + compile "org.apache.polygene.library:org.apache.polygene.library.restlet:$polygeneVersion" + compile "org.apache.polygene.extension:org.apache.polygene.extension.entitystore-file:$polygeneVersion" + compile "org.apache.polygene.extension:org.apache.polygene.extension.indexing-rdf:$polygeneVersion" + +} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/c3175b92/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/common/ConfigModuleWriter.java ---------------------------------------------------------------------- diff --git a/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/common/ConfigModuleWriter.java b/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/common/ConfigModuleWriter.java new file mode 100644 index 0000000..74c4afc --- /dev/null +++ b/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/common/ConfigModuleWriter.java @@ -0,0 +1,71 @@ +/* + * 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.tools.shell.create.project.common; + +import java.io.IOException; +import java.io.PrintWriter; +import java.util.Map; +import org.apache.polygene.tools.shell.FileUtils; + +public class ConfigModuleWriter +{ + + public void writeClass( Map<String, String> properties ) + throws IOException + { + String rootPackage = properties.get( "root.package" ); + String projectName = properties.get( "project.name" ); + try (PrintWriter pw = createPrinter( properties )) + { + pw.print( "package " ); + pw.print( properties.get( "root.package" ) ); + pw.println( ".bootstrap.config;" ); + pw.println(); + pw.println( + "import org.apache.polygene.api.common.Visibility;\n" + + "import org.apache.polygene.bootstrap.AssemblyException;\n" + + "import org.apache.polygene.bootstrap.LayerAssembly;\n" + + "import org.apache.polygene.bootstrap.ModuleAssembly;\n" + + "import org.apache.polygene.bootstrap.layered.ModuleAssembler;\n" + + "import org.apache.polygene.entitystore.memory.MemoryEntityStoreService;\n" + + "\n" + + "public class ConfigModule\n" + + " implements ModuleAssembler\n" + + "{\n" + + " @Override\n" + + " public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )\n" + + " throws AssemblyException\n" + + " {\n" + + " module.services( MemoryEntityStoreService.class ).visibleIn( Visibility.layer );\n" + + " return module;\n" + + " }\n" + + "}\n"); + } + } + + private PrintWriter createPrinter( Map<String, String> properties ) + throws IOException + { + String packagename = properties.get( "root.package" ).replaceAll( "\\.", "/" ) + "/bootstrap/config/"; + String classname = "ConfigModule"; + return FileUtils.createJavaClassPrintWriter( properties, "bootstrap", packagename, classname ); + } +} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/c3175b92/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/common/SerializationModuleWriter.java ---------------------------------------------------------------------- diff --git a/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/common/SerializationModuleWriter.java b/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/common/SerializationModuleWriter.java new file mode 100644 index 0000000..9abb1cd --- /dev/null +++ b/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/common/SerializationModuleWriter.java @@ -0,0 +1,72 @@ +/* + * 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.tools.shell.create.project.common; + +import java.io.IOException; +import java.io.PrintWriter; +import java.util.Map; +import org.apache.polygene.tools.shell.FileUtils; + +public class SerializationModuleWriter +{ + + public void writeClass( Map<String, String> properties ) + throws IOException + { + String rootPackage = properties.get( "root.package" ); + String projectName = properties.get( "project.name" ); + try (PrintWriter pw = createPrinter( properties )) + { + pw.print( "package " ); + pw.print( properties.get( "root.package" ) ); + pw.println( ".bootstrap.infrastructure;" ); + pw.println(); + pw.println( + "import org.apache.polygene.api.common.Visibility;\n" + + "import org.apache.polygene.bootstrap.AssemblyException;\n" + + "import org.apache.polygene.bootstrap.LayerAssembly;\n" + + "import org.apache.polygene.bootstrap.ModuleAssembly;\n" + + "import org.apache.polygene.bootstrap.layered.ModuleAssembler;\n" + + "\n" + + "public class SerializationModule\n" + + " implements ModuleAssembler\n" + + "{\n" + + " public static final String NAME = \"Serialization Module\";\n" + + "\n" + + " @Override\n" + + " public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )\n" + + " throws AssemblyException\n" + + " {\n" + + " return module;\n" + + " }\n" + + "}\n" + ); + } + } + + private PrintWriter createPrinter( Map<String, String> properties ) + throws IOException + { + String packagename = properties.get( "root.package" ).replaceAll( "\\.", "/" ) + "/bootstrap/infrastructure/"; + String classname = "SerializationModule"; + return FileUtils.createJavaClassPrintWriter( properties, "bootstrap", packagename, classname ); + } +}
