http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a7bdc408/tools/generator-polygene/app/templates/Heroes/webapp/styles.css ---------------------------------------------------------------------- diff --git a/tools/generator-polygene/app/templates/Heroes/webapp/styles.css b/tools/generator-polygene/app/templates/Heroes/webapp/styles.css deleted file mode 100644 index 1774fd6..0000000 --- a/tools/generator-polygene/app/templates/Heroes/webapp/styles.css +++ /dev/null @@ -1,149 +0,0 @@ -/* Master Styles */ -h1 { - color: #369; - font-family: Arial, Helvetica, sans-serif; - font-size: 250%; -} -h2, h3 { - color: #444; - font-family: Arial, Helvetica, sans-serif; - font-weight: lighter; -} -body { - margin: 2em; -} -body, input[text], button { - color: #888; - font-family: Cambria, Georgia; -} -a { - cursor: pointer; - cursor: hand; -} -button { - font-family: Arial; - background-color: #eee; - border: none; - padding: 5px 10px; - border-radius: 4px; - cursor: pointer; - cursor: hand; -} -button:hover { - background-color: #cfd8dc; -} -button:disabled { - background-color: #eee; - color: #aaa; - cursor: auto; -} - -/* Navigation link styles */ -nav a { - padding: 5px 10px; - text-decoration: none; - margin-top: 10px; - display: inline-block; - background-color: #eee; - border-radius: 4px; -} -nav a:visited, a:link { - color: #607D8B; -} -nav a:hover { - color: #039be5; - background-color: #CFD8DC; -} -nav a.router-link-active { - color: #039be5; -} - -/* items class */ -.items { - margin: 0 0 2em 0; - list-style-type: none; - padding: 0; - width: 24em; -} -.items li { - cursor: pointer; - position: relative; - left: 0; - background-color: #EEE; - margin: .5em; - padding: .3em 0; - height: 1.6em; - border-radius: 4px; -} -.items li:hover { - color: #607D8B; - background-color: #DDD; - left: .1em; -} -.items li.selected:hover { - background-color: #BBD8DC; - color: white; -} -.items .text { - position: relative; - top: -3px; -} -.items { - margin: 0 0 2em 0; - list-style-type: none; - padding: 0; - width: 24em; -} -.items li { - cursor: pointer; - position: relative; - left: 0; - background-color: #EEE; - margin: .5em; - padding: .3em 0; - height: 1.6em; - border-radius: 4px; -} -.items li:hover { - color: #607D8B; - background-color: #DDD; - left: .1em; -} -.items li.selected { - background-color: #CFD8DC; - color: white; -} - -.items li.selected:hover { - background-color: #BBD8DC; -} -.items .text { - position: relative; - top: -3px; -} -.items .badge { - display: inline-block; - font-size: small; - color: white; - padding: 0.8em 0.7em 0 0.7em; - background-color: #607D8B; - line-height: 1em; - position: relative; - left: -1px; - top: -4px; - height: 1.8em; - margin-right: .8em; - border-radius: 4px 0 0 4px; -} - -/* everywhere else */ -* { - font-family: Arial, Helvetica, sans-serif; -} - - -/* -Copyright 2016 Google Inc. All Rights Reserved. -Use of this source code is governed by an MIT-style license that -can be found in the LICENSE file at http://angular.io/license -*/ \ No newline at end of file
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a7bdc408/tools/generator-polygene/app/templates/InfrastructureLayer/CachingModule/bootstrap.tmpl ---------------------------------------------------------------------- diff --git a/tools/generator-polygene/app/templates/InfrastructureLayer/CachingModule/bootstrap.tmpl b/tools/generator-polygene/app/templates/InfrastructureLayer/CachingModule/bootstrap.tmpl new file mode 100644 index 0000000..4945277 --- /dev/null +++ b/tools/generator-polygene/app/templates/InfrastructureLayer/CachingModule/bootstrap.tmpl @@ -0,0 +1,51 @@ +<%# + * 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.cache.<%- polygene.caching.toLowerCase() %>.assembly.<%- polygene.caching %>Assembler; + +public class <%- polygene.caching %>CachingModule + implements ModuleAssembler +{ + public static final String NAME = "<%- polygene.caching %> Caching Module"; + private final ModuleAssembly configModule; + + public <%- polygene.caching %>CachingModule( ModuleAssembly configModule ) + { + this.configModule = configModule; + } + + @Override + public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module ) + throws AssemblyException + { + new <%- polygene.caching %>Assembler() + .visibleIn(Visibility.layer) + .withConfig( configModule, Visibility.application ) + .assemble( module ); + + return module; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a7bdc408/tools/generator-polygene/app/templates/InfrastructureLayer/CachingModule/module.js ---------------------------------------------------------------------- diff --git a/tools/generator-polygene/app/templates/InfrastructureLayer/CachingModule/module.js b/tools/generator-polygene/app/templates/InfrastructureLayer/CachingModule/module.js new file mode 100644 index 0000000..474899c --- /dev/null +++ b/tools/generator-polygene/app/templates/InfrastructureLayer/CachingModule/module.js @@ -0,0 +1,11 @@ +module.exports = { + + write: function (p) { + if (p.caching !== "None") { + + p.copyTemplate(p.ctx, + 'InfrastructureLayer/CachingModule/bootstrap.tmpl', + 'bootstrap/src/main/java/' + p.javaPackageDir + '/bootstrap/infrastructure/' + p.caching + 'CachingModule.java'); + } + } +}; http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a7bdc408/tools/generator-polygene/app/templates/InfrastructureLayer/FileConfigurationModule/bootstrap.tmpl ---------------------------------------------------------------------- diff --git a/tools/generator-polygene/app/templates/InfrastructureLayer/FileConfigurationModule/bootstrap.tmpl b/tools/generator-polygene/app/templates/InfrastructureLayer/FileConfigurationModule/bootstrap.tmpl new file mode 100644 index 0000000..ab2ad2c --- /dev/null +++ b/tools/generator-polygene/app/templates/InfrastructureLayer/FileConfigurationModule/bootstrap.tmpl @@ -0,0 +1,41 @@ +<%# + * 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.library.fileconfig.FileConfigurationAssembler; + +public class FileConfigurationModule + implements ModuleAssembler +{ + public static String NAME; + + @Override + public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module ) + throws AssemblyException + { + new FileConfigurationAssembler().visibleIn( Visibility.layer ).assemble( module ); + return module; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a7bdc408/tools/generator-polygene/app/templates/InfrastructureLayer/FileConfigurationModule/module.js ---------------------------------------------------------------------- diff --git a/tools/generator-polygene/app/templates/InfrastructureLayer/FileConfigurationModule/module.js b/tools/generator-polygene/app/templates/InfrastructureLayer/FileConfigurationModule/module.js new file mode 100644 index 0000000..7ce44ef --- /dev/null +++ b/tools/generator-polygene/app/templates/InfrastructureLayer/FileConfigurationModule/module.js @@ -0,0 +1,8 @@ +module.exports = { + + write: function (p) { + p.copyTemplate(p.ctx, + 'InfrastructureLayer/FileConfigurationModule/bootstrap.tmpl', + 'bootstrap/src/main/java/' + p.javaPackageDir + '/bootstrap/infrastructure/FileConfigurationModule.java'); + } +}; http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a7bdc408/tools/generator-polygene/app/templates/InfrastructureLayer/IndexingModule/bootstrap.tmpl ---------------------------------------------------------------------- diff --git a/tools/generator-polygene/app/templates/InfrastructureLayer/IndexingModule/bootstrap.tmpl b/tools/generator-polygene/app/templates/InfrastructureLayer/IndexingModule/bootstrap.tmpl new file mode 100644 index 0000000..a1f9479 --- /dev/null +++ b/tools/generator-polygene/app/templates/InfrastructureLayer/IndexingModule/bootstrap.tmpl @@ -0,0 +1,52 @@ +<%# + * 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.index.<%- polygene.indexing.toLowerCase() %>.assembly.<%- polygene.indexing %>IndexingAssembler; + +public class <%- polygene.indexing %>IndexingModule + implements ModuleAssembler +{ + public static final String NAME = "<%- polygene.indexing %> Indexing Module"; + private final ModuleAssembly configModule; + + public <%- polygene.indexing %>IndexingModule( ModuleAssembly configModule ) + { + this.configModule = configModule; + } + + @Override + public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module ) + throws AssemblyException + { + new <%- polygene.indexing %>IndexingAssembler() + .visibleIn( Visibility.application ) + .identifiedBy( "indexing-<%- polygene.indexing %>" ) + .withConfig( configModule, Visibility.application ) + .assemble( module ); + return module; + } +} + http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a7bdc408/tools/generator-polygene/app/templates/InfrastructureLayer/IndexingModule/module.js ---------------------------------------------------------------------- diff --git a/tools/generator-polygene/app/templates/InfrastructureLayer/IndexingModule/module.js b/tools/generator-polygene/app/templates/InfrastructureLayer/IndexingModule/module.js new file mode 100644 index 0000000..e34ef57 --- /dev/null +++ b/tools/generator-polygene/app/templates/InfrastructureLayer/IndexingModule/module.js @@ -0,0 +1,8 @@ +module.exports = { + + write: function (p) { + p.copyTemplate(p.ctx, + 'InfrastructureLayer/IndexingModule/bootstrap.tmpl', + 'bootstrap/src/main/java/' + p.javaPackageDir + '/bootstrap/infrastructure/' + p.indexing + 'IndexingModule.java'); + } +}; http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a7bdc408/tools/generator-polygene/app/templates/InfrastructureLayer/MetricsModule/bootstrap.tmpl ---------------------------------------------------------------------- diff --git a/tools/generator-polygene/app/templates/InfrastructureLayer/MetricsModule/bootstrap.tmpl b/tools/generator-polygene/app/templates/InfrastructureLayer/MetricsModule/bootstrap.tmpl new file mode 100644 index 0000000..2bbc875 --- /dev/null +++ b/tools/generator-polygene/app/templates/InfrastructureLayer/MetricsModule/bootstrap.tmpl @@ -0,0 +1,48 @@ +<%# + * 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.metrics.<%- polygene.metrics.toLowerCase() %>.assembly.<%- polygene.metrics %>MetricsAssembler; + +public class <%- polygene.metrics %>MetricsModule + implements ModuleAssembler +{ + public static final String NAME = "<%- polygene.metrics %> Metrics Module"; + private final ModuleAssembly configModule; + + public <%- polygene.metrics %>MetricsModule( ModuleAssembly configModule ) + { + this.configModule = configModule; + } + + @Override + public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module ) + throws AssemblyException + { + new <%- polygene.metrics %>Assembler(Visibility.application, Visibility.module).assemble( module ); + return module; + } +} + http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a7bdc408/tools/generator-polygene/app/templates/InfrastructureLayer/MetricsModule/module.js ---------------------------------------------------------------------- diff --git a/tools/generator-polygene/app/templates/InfrastructureLayer/MetricsModule/module.js b/tools/generator-polygene/app/templates/InfrastructureLayer/MetricsModule/module.js new file mode 100644 index 0000000..6100c5c --- /dev/null +++ b/tools/generator-polygene/app/templates/InfrastructureLayer/MetricsModule/module.js @@ -0,0 +1,10 @@ +module.exports = { + + write: function (p) { + if (p.metrics !== "None") { + p.copyTemplate(p.ctx, + 'InfrastructureLayer/MetricsModule/bootstrap.tmpl', + 'bootstrap/src/main/java/' + p.javaPackageDir + '/bootstrap/infrastructure/' + p.metrics + 'MetricsModule.java'); + } + } +}; http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a7bdc408/tools/generator-polygene/app/templates/InfrastructureLayer/SerializationModule/bootstrap.tmpl ---------------------------------------------------------------------- diff --git a/tools/generator-polygene/app/templates/InfrastructureLayer/SerializationModule/bootstrap.tmpl b/tools/generator-polygene/app/templates/InfrastructureLayer/SerializationModule/bootstrap.tmpl new file mode 100644 index 0000000..ea455cd --- /dev/null +++ b/tools/generator-polygene/app/templates/InfrastructureLayer/SerializationModule/bootstrap.tmpl @@ -0,0 +1,43 @@ +<%# + * 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.<%- polygene.serialization.toLowerCase() %>.<%- polygene.serialization %>ValueSerializationAssembler; + +public class <%- polygene.serialization %>ValueSerializationModule + implements ModuleAssembler +{ + public static final String NAME = "<%- polygene.serialization %> Serialization Module"; + + @Override + public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module ) + throws AssemblyException + { + new <%- polygene.serialization %>ValueSerializationAssembler() + .visibleIn( Visibility.application ) + .assemble( module ); + return module; + } +} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a7bdc408/tools/generator-polygene/app/templates/InfrastructureLayer/SerializationModule/module.js ---------------------------------------------------------------------- diff --git a/tools/generator-polygene/app/templates/InfrastructureLayer/SerializationModule/module.js b/tools/generator-polygene/app/templates/InfrastructureLayer/SerializationModule/module.js new file mode 100644 index 0000000..7e60e99 --- /dev/null +++ b/tools/generator-polygene/app/templates/InfrastructureLayer/SerializationModule/module.js @@ -0,0 +1,8 @@ +module.exports = { + + write: function (p) { + p.copyTemplate(p.ctx, + 'InfrastructureLayer/SerializationModule/bootstrap.tmpl', + 'bootstrap/src/main/java/' + p.javaPackageDir + '/bootstrap/infrastructure/' + p.serialization + 'ValueSerializationModule.java'); + } +}; http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a7bdc408/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/bootstrap.tmpl ---------------------------------------------------------------------- diff --git a/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/bootstrap.tmpl b/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/bootstrap.tmpl new file mode 100644 index 0000000..8e68e2f --- /dev/null +++ b/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/bootstrap.tmpl @@ -0,0 +1,51 @@ +<%# + * 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.entitystore.<%- polygene.entitystore.toLowerCase() %>.assembly.<%- polygene.entitystore %>EntityStoreAssembler; + +public class <%- polygene.entitystore %>StorageModule + implements ModuleAssembler +{ + public static final String NAME = "<%- polygene.entitystore %> Storage Module"; + private final ModuleAssembly configModule; + + public <%- polygene.entitystore %>StorageModule( ModuleAssembly configModule ) + { + this.configModule = configModule; + } + + @Override + public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module ) + throws AssemblyException + { + new <%- polygene.entitystore %>EntityStoreAssembler() + .visibleIn( Visibility.application ) + .withConfig( configModule, Visibility.application ) + .identifiedBy( "entitystore-<%- polygene.entitystore %>" ) + .assemble( module ); + return module; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a7bdc408/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/module.js ---------------------------------------------------------------------- diff --git a/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/module.js b/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/module.js new file mode 100644 index 0000000..51488e0 --- /dev/null +++ b/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/module.js @@ -0,0 +1,8 @@ +module.exports = { + + write: function (p) { + p.copyTemplate(p.ctx, + 'InfrastructureLayer/StorageModule/bootstrap.tmpl', + 'bootstrap/src/main/java/' + p.javaPackageDir + '/bootstrap/infrastructure/' + p.entitystore + 'StorageModule.java'); + } +}; http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a7bdc408/tools/generator-polygene/app/templates/InfrastructureLayer/bootstrap.tmpl ---------------------------------------------------------------------- diff --git a/tools/generator-polygene/app/templates/InfrastructureLayer/bootstrap.tmpl b/tools/generator-polygene/app/templates/InfrastructureLayer/bootstrap.tmpl index 2b86a4d..d02d6a9 100644 --- a/tools/generator-polygene/app/templates/InfrastructureLayer/bootstrap.tmpl +++ b/tools/generator-polygene/app/templates/InfrastructureLayer/bootstrap.tmpl @@ -41,10 +41,15 @@ public class InfrastructureLayer extends LayeredLayerAssembler throws AssemblyException { createModule( layer, FileConfigurationModule.class ); - + createModule( layer, <%= polygene.serialization %>ValueSerializationModule.class ); +<% if( polygene.metrics !== "None" ) { %> + createModule( layer, <%= polygene.metrics %>MetricsModule.class ); +<% } %> +<% if( polygene.caching !== "None" ) { %> + createModule( layer, <%= polygene.caching %>CachingModule.class ); +<% } %> new <%= polygene.entitystore %>StorageModule( configModule ).assemble( layer, layer.module( <%= polygene.entitystore %>StorageModule.NAME ) ); new <%= polygene.indexing %>IndexingModule( configModule ).assemble( layer, layer.module( <%= polygene.indexing %>IndexingModule.NAME ) ); - new <%= polygene.serialization %>SerializationModule().assemble( layer, layer.module( <%= polygene.serialization %>SerializationModule.NAME ) ); return layer; } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a7bdc408/tools/generator-polygene/app/templates/InfrastructureLayer/layer.js ---------------------------------------------------------------------- diff --git a/tools/generator-polygene/app/templates/InfrastructureLayer/layer.js b/tools/generator-polygene/app/templates/InfrastructureLayer/layer.js new file mode 100644 index 0000000..ca844d1 --- /dev/null +++ b/tools/generator-polygene/app/templates/InfrastructureLayer/layer.js @@ -0,0 +1,10 @@ + +module.exports = { + + write: function (p) { + p.copyTemplate(p.ctx, + 'InfrastructureLayer/bootstrap.tmpl', + 'bootstrap/src/main/java/' + p.javaPackageDir + '/bootstrap/infrastructure/InfrastructureLayer.java'); + p.copyModules(__dirname ); + } +}; http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a7bdc408/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/a7bdc408/tools/generator-polygene/app/templates/NoCachingModule/bootstrap.tmpl ---------------------------------------------------------------------- diff --git a/tools/generator-polygene/app/templates/NoCachingModule/bootstrap.tmpl b/tools/generator-polygene/app/templates/NoCachingModule/bootstrap.tmpl deleted file mode 100644 index b5ebe24..0000000 --- a/tools/generator-polygene/app/templates/NoCachingModule/bootstrap.tmpl +++ /dev/null @@ -1,46 +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.entitystore.file.assembly.FileEntityStoreAssembler; - -public class NoCachingModule - implements ModuleAssembler -{ - public static final String NAME = "No Caching Module"; - private final ModuleAssembly configModule; - - public NoCachingModule( ModuleAssembly configModule ) - { - this.configModule = configModule; - } - - @Override - public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module ) - throws AssemblyException - { - return module; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a7bdc408/tools/generator-polygene/app/templates/RdfIndexingModule/bootstrap.tmpl ---------------------------------------------------------------------- diff --git a/tools/generator-polygene/app/templates/RdfIndexingModule/bootstrap.tmpl b/tools/generator-polygene/app/templates/RdfIndexingModule/bootstrap.tmpl deleted file mode 100644 index 8376a2b..0000000 --- a/tools/generator-polygene/app/templates/RdfIndexingModule/bootstrap.tmpl +++ /dev/null @@ -1,50 +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.index.rdf.assembly.RdfNativeSesameStoreAssembler; -import org.apache.polygene.library.rdf.repository.NativeConfiguration; - -public class RdfIndexingModule - implements ModuleAssembler -{ - public static final String NAME = "Rdf Indexing Module"; - private final ModuleAssembly configModule; - - public RdfIndexingModule( ModuleAssembly configModule ) - { - this.configModule = configModule; - } - - @Override - public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module ) - throws AssemblyException - { - configModule.entities( NativeConfiguration.class ).visibleIn( Visibility.application ); - new RdfNativeSesameStoreAssembler(Visibility.application, Visibility.module).assemble( module ); - return module; - } -} - http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a7bdc408/tools/generator-polygene/app/templates/RestApiModule/HardcodedSecurityRepositoryMixin.tmpl ---------------------------------------------------------------------- diff --git a/tools/generator-polygene/app/templates/RestApiModule/HardcodedSecurityRepositoryMixin.tmpl b/tools/generator-polygene/app/templates/RestApiModule/HardcodedSecurityRepositoryMixin.tmpl deleted file mode 100644 index fc73bf6..0000000 --- a/tools/generator-polygene/app/templates/RestApiModule/HardcodedSecurityRepositoryMixin.tmpl +++ /dev/null @@ -1,54 +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 %>.model.security; - -import java.util.Collections; -import java.util.List; -import org.apache.polygene.api.unitofwork.concern.UnitOfWorkPropagation; - -public class HardcodedSecurityRepositoryMixin - implements SecurityRepository -{ - - @Override - public boolean verifyPassword( String userName, String password ) - { - if( userName.equals("admin") && password.equals("secret") ) - { - return true; - } - if( userName.equals("user") && password.equals("123") ) - { - return true; - } - return false; - } - - @UnitOfWorkPropagation - public List<String> findRoleNamesOfUser( String name ) - { - if( "admin".equals( name ) ) - { - return Collections.singletonList("admin"); - } - return Collections.singletonList("user"); - } -} - http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a7bdc408/tools/generator-polygene/app/templates/RestApiModule/SecurityRepository.tmpl ---------------------------------------------------------------------- diff --git a/tools/generator-polygene/app/templates/RestApiModule/SecurityRepository.tmpl b/tools/generator-polygene/app/templates/RestApiModule/SecurityRepository.tmpl deleted file mode 100644 index f007485..0000000 --- a/tools/generator-polygene/app/templates/RestApiModule/SecurityRepository.tmpl +++ /dev/null @@ -1,36 +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 %>.model.security; - -import java.util.List; -import org.apache.polygene.api.concern.Concerns; -import org.apache.polygene.api.unitofwork.concern.UnitOfWorkConcern; -import org.apache.polygene.api.unitofwork.concern.UnitOfWorkPropagation; - -@Concerns( UnitOfWorkConcern.class ) -public interface SecurityRepository -{ - @UnitOfWorkPropagation - boolean verifyPassword( String user, String password ); - - @UnitOfWorkPropagation - List<String> findRoleNamesOfUser( String name ); -} - http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a7bdc408/tools/generator-polygene/app/templates/RestApiModule/SimpleEnroler.tmpl ---------------------------------------------------------------------- diff --git a/tools/generator-polygene/app/templates/RestApiModule/SimpleEnroler.tmpl b/tools/generator-polygene/app/templates/RestApiModule/SimpleEnroler.tmpl deleted file mode 100644 index 3b21a9d..0000000 --- a/tools/generator-polygene/app/templates/RestApiModule/SimpleEnroler.tmpl +++ /dev/null @@ -1,52 +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 %>.rest.security; - -import java.util.ArrayList; -import java.util.List; -import org.apache.polygene.api.injection.scope.Service; -import org.apache.polygene.api.injection.scope.Uses; -import org.restlet.Application; -import org.restlet.data.ClientInfo; -import org.restlet.security.Enroler; -import org.restlet.security.Role; -import <%= packageName %>.model.security.SecurityRepository; - - -public class SimpleEnroler - implements Enroler -{ - @Service - private SecurityRepository repository; - - @Uses - private Application application; - - @Override - public void enrole( ClientInfo clientInfo ) - { - org.restlet.security.User user = clientInfo.getUser(); - String name = user.getName(); - List<String> roleList = repository.findRoleNamesOfUser( name ); - List<Role> restletRoles = new ArrayList<>(); - roleList.stream().map( roleName -> Role.get( application, roleName ) ); - clientInfo.setRoles( restletRoles ); - } -} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a7bdc408/tools/generator-polygene/app/templates/RestApiModule/SimpleVerifier.tmpl ---------------------------------------------------------------------- diff --git a/tools/generator-polygene/app/templates/RestApiModule/SimpleVerifier.tmpl b/tools/generator-polygene/app/templates/RestApiModule/SimpleVerifier.tmpl deleted file mode 100644 index e8b7e11..0000000 --- a/tools/generator-polygene/app/templates/RestApiModule/SimpleVerifier.tmpl +++ /dev/null @@ -1,46 +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 %>.rest.security; - -import org.apache.polygene.api.injection.scope.Service; -import org.restlet.security.SecretVerifier; -import org.restlet.security.Verifier; -import <%= packageName %>.model.security.SecurityRepository; - -public class SimpleVerifier extends SecretVerifier - implements Verifier -{ - @Service - private SecurityRepository repository; - - @Override - public int verify( String user, char[] secret ) - { - if( user == null || secret == null ) - { - return RESULT_UNKNOWN; - } - if( repository.verifyPassword( user, String.valueOf( secret ) ) ) - { - return RESULT_VALID; - } - return RESULT_INVALID; - } -} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a7bdc408/tools/generator-polygene/app/templates/RestApiModule/bootstrap.tmpl ---------------------------------------------------------------------- diff --git a/tools/generator-polygene/app/templates/RestApiModule/bootstrap.tmpl b/tools/generator-polygene/app/templates/RestApiModule/bootstrap.tmpl deleted file mode 100644 index 202776d..0000000 --- a/tools/generator-polygene/app/templates/RestApiModule/bootstrap.tmpl +++ /dev/null @@ -1,56 +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.connectivity; - -import <%= packageName %>.rest.security.SimpleEnroler; -import <%= packageName %>.rest.security.SimpleVerifier; -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.library.restlet.assembly.RestletCrudConnectivityAssembler; -import org.apache.polygene.library.restlet.resource.EntryPoint; -<% if( hasFeature('sample (heroes) web application') ) { %> -import <%= packageName %>.model.heroes.Hero; -<% } -%> - -public class RestApiModule - implements ModuleAssembler -{ - public static String NAME; - - @Override - public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module ) - throws AssemblyException - { - module.objects( SimpleVerifier.class, SimpleEnroler.class); - - new RestletCrudConnectivityAssembler().assemble( module ); - module.values( EntryPoint.class ); -<% if( hasFeature('sample (heroes) web application') ) { -%> - module.values( Hero.class ); - module.services( Hero.class ); -<% } else { -%> - module.values( /* add value types */ ); - module.services( /* add services */ ); -<% } -%> - return module; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a7bdc408/tools/generator-polygene/app/templates/SecurityModule/SecurityRepository.tmpl ---------------------------------------------------------------------- diff --git a/tools/generator-polygene/app/templates/SecurityModule/SecurityRepository.tmpl b/tools/generator-polygene/app/templates/SecurityModule/SecurityRepository.tmpl deleted file mode 100644 index c503999..0000000 --- a/tools/generator-polygene/app/templates/SecurityModule/SecurityRepository.tmpl +++ /dev/null @@ -1,35 +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 %>.model.security; - -import java.util.List; -import org.apache.polygene.api.concern.Concerns; -import org.apache.polygene.api.unitofwork.concern.UnitOfWorkConcern; -import org.apache.polygene.api.unitofwork.concern.UnitOfWorkPropagation; - -@Concerns( UnitOfWorkConcern.class ) -public interface SecurityRepository -{ - @UnitOfWorkPropagation - boolean verifyPassword( String user, String password ); - - @UnitOfWorkPropagation - List<String> findRoleNamesOfUser( String name ); -} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a7bdc408/tools/generator-polygene/app/templates/SecurityModule/bootstrap.tmpl ---------------------------------------------------------------------- diff --git a/tools/generator-polygene/app/templates/SecurityModule/bootstrap.tmpl b/tools/generator-polygene/app/templates/SecurityModule/bootstrap.tmpl deleted file mode 100644 index b944612..0000000 --- a/tools/generator-polygene/app/templates/SecurityModule/bootstrap.tmpl +++ /dev/null @@ -1,46 +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.domain; - -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 <%= packageName %>.model.security.SecurityRepository; -import <%= packageName %>.model.security.HardcodedSecurityRepositoryMixin; - -public class SecurityModule - implements ModuleAssembler -{ - public static String NAME; - - @Override - public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module ) - throws AssemblyException - { - module.services( SecurityRepository.class ) - .withMixins( HardcodedSecurityRepositoryMixin.class ) - .visibleIn( Visibility.application ) - .instantiateOnStartup(); - - return module; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a7bdc408/tools/generator-polygene/app/templates/SolrIndexingModule/bootstrap.tmpl ---------------------------------------------------------------------- diff --git a/tools/generator-polygene/app/templates/SolrIndexingModule/bootstrap.tmpl b/tools/generator-polygene/app/templates/SolrIndexingModule/bootstrap.tmpl deleted file mode 100644 index 2644f78..0000000 --- a/tools/generator-polygene/app/templates/SolrIndexingModule/bootstrap.tmpl +++ /dev/null @@ -1,49 +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.index.rdf.assembly.RdfNativeSesameStoreAssembler; -import org.apache.polygene.library.rdf.repository.NativeConfiguration; - -public class SolrIndexingModule - implements ModuleAssembler -{ - public static final String NAME = "Solr Indexing Module"; - private final ModuleAssembly configModule; - - public SolrIndexingModule( ModuleAssembly configModule ) - { - this.configModule = configModule; - } - - @Override - public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module ) - throws AssemblyException - { - new SolrAssembler(Visibility.application, Visibility.module).assemble( module ); - return module; - } -} - http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a7bdc408/tools/generator-polygene/app/templates/StorageModule/bootstrap.tmpl ---------------------------------------------------------------------- diff --git a/tools/generator-polygene/app/templates/StorageModule/bootstrap.tmpl b/tools/generator-polygene/app/templates/StorageModule/bootstrap.tmpl deleted file mode 100644 index 467fadd..0000000 --- a/tools/generator-polygene/app/templates/StorageModule/bootstrap.tmpl +++ /dev/null @@ -1,51 +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.entitystore.<%- polygene.entitystore.toLowerCase() %>.assembly.<%- polygene.entitystore %>EntityStoreAssembler; - -public class <%- polygene.entitystore %>StorageModule - implements ModuleAssembler -{ - public static final String NAME = "<%- polygene.entitystore %> Storage Module"; - private final ModuleAssembly configModule; - - public <%- polygene.entitystore %>StorageModule( ModuleAssembly configModule ) - { - this.configModule = configModule; - } - - @Override - public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module ) - throws AssemblyException - { - new <%- polygene.entitystore %>EntityStoreAssembler() - .visibleIn( Visibility.application ) - .withConfig( configModule, Visibility.application ) - .identifiedBy( "<%- polygene.entitystore %>store" ) - .assemble( module ); - return module; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a7bdc408/tools/generator-polygene/app/templates/buildtool/build.js ---------------------------------------------------------------------- diff --git a/tools/generator-polygene/app/templates/buildtool/build.js b/tools/generator-polygene/app/templates/buildtool/build.js new file mode 100644 index 0000000..7df3c75 --- /dev/null +++ b/tools/generator-polygene/app/templates/buildtool/build.js @@ -0,0 +1,22 @@ +module.exports = { + + write: function (p) { + copyBuildFile(p, "app"); + copyBuildFile(p, "bootstrap"); + copyBuildFile(p, "model"); + copyBuildFile(p, "rest"); + p.copyTemplate(p.ctx, 'buildtool/gradle-root.tmpl', 'build.gradle'); + p.copyTemplate(p.ctx, 'buildtool/settings.tmpl', 'settings.gradle'); + p.copyTemplate(p.ctx, 'buildtool/gradlew.tmpl', 'gradlew'); + p.copyTemplate(p.ctx, 'buildtool/gradlew-bat.tmpl', 'gradlew.bat'); + + p.ctx.fs.copy(p.ctx.templatePath('buildtool/gradle-wrapper.jar_'), p.ctx.destinationPath('gradle/wrapper/gradle-wrapper.jar')); + p.ctx.fs.copy(p.ctx.templatePath('buildtool/gradle-wrapper.properties_'), p.ctx.destinationPath('gradle/wrapper/gradle-wrapper.properties')); + } +}; + +function copyBuildFile(p, subproject) { + p.copyTemplate(p.ctx, + 'buildtool/gradle-' + subproject + '.tmpl', + subproject + '/build.gradle'); +} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a7bdc408/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 ceb0541..bc0a651 100644 --- a/tools/generator-polygene/app/templates/buildtool/gradle-bootstrap.tmpl +++ b/tools/generator-polygene/app/templates/buildtool/gradle-bootstrap.tmpl @@ -33,4 +33,12 @@ dependencies { compile "org.apache.polygene.extensions:org.apache.polygene.extension.indexing-<%= polygene.indexing.toLowerCase() %>:$polygeneVersion" compile "org.apache.polygene.extensions:org.apache.polygene.extension.valueserialization-<%= polygene.serialization.toLowerCase() %>:$polygeneVersion" +<% if( polygene.caching !== "None" ) { %> + compile "org.apache.polygene.extensions:org.apache.polygene.extension.cache-<%= polygene.caching.toLowerCase() %>:$polygeneVersion" +<% } %> + +<% if( polygene.metrics !== "None" ) { %> + compile "org.apache.polygene.extensions:org.apache.polygene.extension.metrics-<%= polygene.metrics.toLowerCase() %>:$polygeneVersion" +<% } %> + } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a7bdc408/tools/generator-polygene/app/templates/buildtool/settings.tmpl ---------------------------------------------------------------------- diff --git a/tools/generator-polygene/app/templates/buildtool/settings.tmpl b/tools/generator-polygene/app/templates/buildtool/settings.tmpl index 3016193..2d8e164 100644 --- a/tools/generator-polygene/app/templates/buildtool/settings.tmpl +++ b/tools/generator-polygene/app/templates/buildtool/settings.tmpl @@ -22,7 +22,7 @@ include 'app', 'model', 'rest' -rootProject.name = '<%= polygene.entitystore %>' +rootProject.name = '<%= polygene.name %>' validateProject(rootProject, "")
