Repository: zest-java Updated Branches: refs/heads/develop bc55a577d -> 6cafbfa36
ZEST-158, ZEST-171 - Fixing for Geode ES generation. Project: http://git-wip-us.apache.org/repos/asf/zest-java/repo Commit: http://git-wip-us.apache.org/repos/asf/zest-java/commit/55ebd81a Tree: http://git-wip-us.apache.org/repos/asf/zest-java/tree/55ebd81a Diff: http://git-wip-us.apache.org/repos/asf/zest-java/diff/55ebd81a Branch: refs/heads/develop Commit: 55ebd81ae79ce4001e794520c3168b1b29bb35c8 Parents: bc55a57 Author: Niclas Hedhman <[email protected]> Authored: Sat Aug 27 14:31:46 2016 +0800 Committer: Niclas Hedhman <[email protected]> Committed: Sat Aug 27 14:31:46 2016 +0800 ---------------------------------------------------------------------- tools/generator-zest/app/index.js | 36 ++++++------- .../templates/FileStorageModule/bootstrap.tmpl | 53 -------------------- .../app/templates/StorageModule/bootstrap.tmpl | 53 ++++++++++++++++++++ .../templates/buildtool/gradle-bootstrap.tmpl | 8 +-- .../app/templates/buildtool/settings.tmpl | 2 +- 5 files changed, 75 insertions(+), 77 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/zest-java/blob/55ebd81a/tools/generator-zest/app/index.js ---------------------------------------------------------------------- diff --git a/tools/generator-zest/app/index.js b/tools/generator-zest/app/index.js index 4935e0e..3a127c9 100644 --- a/tools/generator-zest/app/index.js +++ b/tools/generator-zest/app/index.js @@ -155,18 +155,7 @@ module.exports = generators.Base.extend( copyZestBootstrap( this, "infrastructure", "FileConfigurationModule", true ); - copyZestBootstrap( this, "infrastructure", "FileStorageModule", hasEntityStore( 'File' ) ); - copyZestBootstrap( this, "infrastructure", "GeodeStorageModule", hasEntityStore( 'Geode' ) ); - copyZestBootstrap( this, "infrastructure", "HazelcastStorageModule", hasEntityStore( 'Hazelcast' ) ); - copyZestBootstrap( this, "infrastructure", "JCloudsStorageModule", hasEntityStore( 'Jclouds' ) ); - copyZestBootstrap( this, "infrastructure", "JdbmStorageModule", hasEntityStore( 'Jdbm' ) ); - copyZestBootstrap( this, "infrastructure", "LevelDbStorageModule", hasEntityStore( 'Leveldb' ) ); - copyZestBootstrap( this, "infrastructure", "InMemoryStorageModule", hasEntityStore( 'Memory' ) ); - copyZestBootstrap( this, "infrastructure", "MongoDbStorageModule", hasEntityStore( 'Mongodb' ) ); - copyZestBootstrap( this, "infrastructure", "PreferencesStorageModule", hasEntityStore( 'Preferences' ) ); - copyZestBootstrap( this, "infrastructure", "RedisStorageModule", hasEntityStore( 'Redis' ) ); - copyZestBootstrap( this, "infrastructure", "RiakStorageModule", hasEntityStore( 'Riak' ) ); - copyZestBootstrap( this, "infrastructure", "SqlStorageModule", hasEntityStore( 'Sql' ) ); + copyEntityStore( this, zest.entitystore ); copyZestBootstrap( this, "infrastructure", "RdfIndexingModule", hasIndexing( 'Rdf' ) ); copyZestBootstrap( this, "infrastructure", "ElasticSearchIndexingModule", hasIndexing( 'Elasticsearch' ) ); @@ -193,14 +182,14 @@ module.exports = generators.Base.extend( copyRestFeature( this, hasFeature( 'rest api' ) ); - this.fs.copyTpl( this.templatePath( 'buildtool/gradle-app.tmpl' ), this.destinationPath( 'app/build.gradle' ), {} ); - this.fs.copyTpl( this.templatePath( 'buildtool/gradle-bootstrap.tmpl' ), this.destinationPath( 'bootstrap/build.gradle' ), {} ); - this.fs.copyTpl( this.templatePath( 'buildtool/gradle-model.tmpl' ), this.destinationPath( 'model/build.gradle' ), {} ); - this.fs.copyTpl( this.templatePath( 'buildtool/gradle-rest.tmpl' ), this.destinationPath( 'rest/build.gradle' ), {} ); - this.fs.copyTpl( this.templatePath( 'buildtool/gradle-root.tmpl' ), this.destinationPath( 'build.gradle' ), {} ); - this.fs.copyTpl( this.templatePath( 'buildtool/settings.tmpl' ), this.destinationPath( 'settings.gradle' ), {projectName: zest.name} ); - this.fs.copyTpl( this.templatePath( 'buildtool/gradlew.tmpl' ), this.destinationPath( 'gradlew' ), {} ); - this.fs.copyTpl( this.templatePath( 'buildtool/gradlew-bat.tmpl' ), this.destinationPath( 'gradlew.bat' ), {} ); + copyTemplate( this, 'buildtool/gradle-app.tmpl', 'app/build.gradle' ); + copyTemplate( this, 'buildtool/gradle-bootstrap.tmpl', 'bootstrap/build.gradle' ); + copyTemplate( this, 'buildtool/gradle-model.tmpl', 'model/build.gradle' ); + copyTemplate( this, 'buildtool/gradle-rest.tmpl', 'rest/build.gradle' ); + copyTemplate( this, 'buildtool/gradle-root.tmpl', 'build.gradle' ); + copyTemplate( this, 'buildtool/settings.tmpl', 'settings.gradle' ); + copyTemplate( this, 'buildtool/gradlew.tmpl', 'gradlew' ); + copyTemplate( this, 'buildtool/gradlew-bat.tmpl', 'gradlew.bat' ); this.fs.copy( this.templatePath( 'buildtool/gradle-wrapper.jar_' ), this.destinationPath( 'gradle/wrapper/gradle-wrapper.jar' ) ); this.fs.copy( this.templatePath( 'buildtool/gradle-wrapper.properties_' ), this.destinationPath( 'gradle/wrapper/gradle-wrapper.properties' ) ); } @@ -217,6 +206,13 @@ function copyZestBootstrap( ctx, layer, moduleName, condition ) } } +function copyEntityStore( ctx, entityStoreName ) +{ + copyTemplate( ctx, + 'StorageModule/bootstrap.tmpl', + 'bootstrap/src/main/java/' + zest.javaPackageDir + '/bootstrap/infrastructure/' + entityStoreName + 'StorageModule.java' ); +} + function copyZestApp( ctx, name, condition ) { if( condition ) http://git-wip-us.apache.org/repos/asf/zest-java/blob/55ebd81a/tools/generator-zest/app/templates/FileStorageModule/bootstrap.tmpl ---------------------------------------------------------------------- diff --git a/tools/generator-zest/app/templates/FileStorageModule/bootstrap.tmpl b/tools/generator-zest/app/templates/FileStorageModule/bootstrap.tmpl deleted file mode 100644 index 0f71243..0000000 --- a/tools/generator-zest/app/templates/FileStorageModule/bootstrap.tmpl +++ /dev/null @@ -1,53 +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.zest.api.common.Visibility; -import org.apache.zest.bootstrap.AssemblyException; -import org.apache.zest.bootstrap.LayerAssembly; -import org.apache.zest.bootstrap.ModuleAssembly; -import org.apache.zest.bootstrap.layered.ModuleAssembler; -import org.apache.zest.entitystore.file.assembly.FileEntityStoreAssembler; - -public class FileStorageModule - implements ModuleAssembler -{ - public static final String NAME = "File Storage Module"; - private final ModuleAssembly configModule; - - public FileStorageModule( ModuleAssembly configModule ) - { - this.configModule = configModule; - } - - @Override - public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module ) - throws AssemblyException - { - module.withDefaultUnitOfWorkFactory(); - - new FileEntityStoreAssembler() - .visibleIn( Visibility.application ) - .withConfig( configModule, Visibility.application ) - .identifiedBy( "filestore" ) - .assemble( module ); - return module; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/55ebd81a/tools/generator-zest/app/templates/StorageModule/bootstrap.tmpl ---------------------------------------------------------------------- diff --git a/tools/generator-zest/app/templates/StorageModule/bootstrap.tmpl b/tools/generator-zest/app/templates/StorageModule/bootstrap.tmpl new file mode 100644 index 0000000..a9a47d2 --- /dev/null +++ b/tools/generator-zest/app/templates/StorageModule/bootstrap.tmpl @@ -0,0 +1,53 @@ +<%# + * 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.zest.api.common.Visibility; +import org.apache.zest.bootstrap.AssemblyException; +import org.apache.zest.bootstrap.LayerAssembly; +import org.apache.zest.bootstrap.ModuleAssembly; +import org.apache.zest.bootstrap.layered.ModuleAssembler; +import org.apache.zest.entitystore.<%- zest.entitystore.toLowerCase() %>.assembly.<%- zest.entitystore %>EntityStoreAssembler; + +public class <%- zest.entitystore %>StorageModule + implements ModuleAssembler +{ + public static final String NAME = "<%- zest.entitystore %> Storage Module"; + private final ModuleAssembly configModule; + + public <%- zest.entitystore %>StorageModule( ModuleAssembly configModule ) + { + this.configModule = configModule; + } + + @Override + public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module ) + throws AssemblyException + { + module.withDefaultUnitOfWorkFactory(); + + new <%- zest.entitystore %>EntityStoreAssembler() + .visibleIn( Visibility.application ) + .withConfig( configModule, Visibility.application ) + .identifiedBy( "<%- zest.entitystore %>store" ) + .assemble( module ); + return module; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/55ebd81a/tools/generator-zest/app/templates/buildtool/gradle-bootstrap.tmpl ---------------------------------------------------------------------- diff --git a/tools/generator-zest/app/templates/buildtool/gradle-bootstrap.tmpl b/tools/generator-zest/app/templates/buildtool/gradle-bootstrap.tmpl index 7fb8ef9..ce9965a 100644 --- a/tools/generator-zest/app/templates/buildtool/gradle-bootstrap.tmpl +++ b/tools/generator-zest/app/templates/buildtool/gradle-bootstrap.tmpl @@ -26,9 +26,11 @@ dependencies { compile "org.apache.zest.library:org.apache.zest.library.fileconfig:$zestVersion" +<% if( hasFeature( 'rest api' ) ) { %> compile "org.apache.zest.library:org.apache.zest.library.restlet:$zestVersion" - compile "org.apache.zest.extension:org.apache.zest.extension.entitystore-file:$zestVersion" - compile "org.apache.zest.extension:org.apache.zest.extension.indexing-rdf:$zestVersion" - compile "org.apache.zest.extension:org.apache.zest.extension.valueserialization-jackson:$zestVersion" +<% } %> + compile "org.apache.zest.extension:org.apache.zest.extension.entitystore-<%= zest.entitystore.toLowerCase() %>:$zestVersion" + compile "org.apache.zest.extension:org.apache.zest.extension.indexing-<%= zest.indexing.toLowerCase() %>:$zestVersion" + compile "org.apache.zest.extension:org.apache.zest.extension.valueserialization-<%= zest.serialization.toLowerCase() %>:$zestVersion" } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/55ebd81a/tools/generator-zest/app/templates/buildtool/settings.tmpl ---------------------------------------------------------------------- diff --git a/tools/generator-zest/app/templates/buildtool/settings.tmpl b/tools/generator-zest/app/templates/buildtool/settings.tmpl index 467ad09..a5c128d 100644 --- a/tools/generator-zest/app/templates/buildtool/settings.tmpl +++ b/tools/generator-zest/app/templates/buildtool/settings.tmpl @@ -22,7 +22,7 @@ include 'app', 'model', 'rest' -rootProject.name = '<%= projectName %>' +rootProject.name = '<%= zest.entitystore %>' validateProject(rootProject, "")
