ZEST-158, ZEST-166 - Fixing for MongoDB 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/78e20260 Tree: http://git-wip-us.apache.org/repos/asf/zest-java/tree/78e20260 Diff: http://git-wip-us.apache.org/repos/asf/zest-java/diff/78e20260 Branch: refs/heads/develop Commit: 78e20260e29326a52f13371fc2a4a4099baa1242 Parents: 130ae7f Author: Niclas Hedhman <[email protected]> Authored: Sat Aug 27 21:07:50 2016 +0800 Committer: Niclas Hedhman <[email protected]> Committed: Sat Aug 27 21:07:50 2016 +0800 ---------------------------------------------------------------------- .../mongodb/MongoMapEntityStoreAssembler.java | 46 ------------------- .../assembly/MongoDBEntityStoreAssembler.java | 48 ++++++++++++++++++++ .../mongodb/MongoMapEntityStoreTest.java | 3 +- .../MongoMapEntityStoreWithCacheTest.java | 3 +- tools/generator-zest/app/index.js | 2 +- 5 files changed, 53 insertions(+), 49 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/zest-java/blob/78e20260/extensions/entitystore-mongodb/src/main/java/org/apache/zest/entitystore/mongodb/MongoMapEntityStoreAssembler.java ---------------------------------------------------------------------- diff --git a/extensions/entitystore-mongodb/src/main/java/org/apache/zest/entitystore/mongodb/MongoMapEntityStoreAssembler.java b/extensions/entitystore-mongodb/src/main/java/org/apache/zest/entitystore/mongodb/MongoMapEntityStoreAssembler.java deleted file mode 100644 index 0455993..0000000 --- a/extensions/entitystore-mongodb/src/main/java/org/apache/zest/entitystore/mongodb/MongoMapEntityStoreAssembler.java +++ /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 org.apache.zest.entitystore.mongodb; - -import org.apache.zest.bootstrap.Assemblers; -import org.apache.zest.bootstrap.AssemblyException; -import org.apache.zest.bootstrap.ModuleAssembly; -import org.apache.zest.bootstrap.ServiceDeclaration; -import org.apache.zest.spi.uuid.UuidIdentityGeneratorService; - -public class MongoMapEntityStoreAssembler - extends Assemblers.VisibilityIdentityConfig<MongoMapEntityStoreAssembler> -{ - @Override - public void assemble( ModuleAssembly module ) - throws AssemblyException - { - module.services( UuidIdentityGeneratorService.class ).visibleIn( visibility() ); - ServiceDeclaration service = module.services( MongoMapEntityStoreService.class ).visibleIn( visibility() ); - if( hasIdentity() ) - { - service.identifiedBy( identity() ); - } - if( hasConfig() ) - { - configModule().entities( MongoEntityStoreConfiguration.class ).visibleIn( configVisibility() ); - } - } -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/78e20260/extensions/entitystore-mongodb/src/main/java/org/apache/zest/entitystore/mongodb/assembly/MongoDBEntityStoreAssembler.java ---------------------------------------------------------------------- diff --git a/extensions/entitystore-mongodb/src/main/java/org/apache/zest/entitystore/mongodb/assembly/MongoDBEntityStoreAssembler.java b/extensions/entitystore-mongodb/src/main/java/org/apache/zest/entitystore/mongodb/assembly/MongoDBEntityStoreAssembler.java new file mode 100644 index 0000000..79ae84e --- /dev/null +++ b/extensions/entitystore-mongodb/src/main/java/org/apache/zest/entitystore/mongodb/assembly/MongoDBEntityStoreAssembler.java @@ -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 org.apache.zest.entitystore.mongodb.assembly; + +import org.apache.zest.bootstrap.Assemblers; +import org.apache.zest.bootstrap.AssemblyException; +import org.apache.zest.bootstrap.ModuleAssembly; +import org.apache.zest.bootstrap.ServiceDeclaration; +import org.apache.zest.entitystore.mongodb.MongoEntityStoreConfiguration; +import org.apache.zest.entitystore.mongodb.MongoMapEntityStoreService; +import org.apache.zest.spi.uuid.UuidIdentityGeneratorService; + +public class MongoDBEntityStoreAssembler + extends Assemblers.VisibilityIdentityConfig<MongoDBEntityStoreAssembler> +{ + @Override + public void assemble( ModuleAssembly module ) + throws AssemblyException + { + module.services( UuidIdentityGeneratorService.class ).visibleIn( visibility() ); + ServiceDeclaration service = module.services( MongoMapEntityStoreService.class ).visibleIn( visibility() ); + if( hasIdentity() ) + { + service.identifiedBy( identity() ); + } + if( hasConfig() ) + { + configModule().entities( MongoEntityStoreConfiguration.class ).visibleIn( configVisibility() ); + } + } +} http://git-wip-us.apache.org/repos/asf/zest-java/blob/78e20260/extensions/entitystore-mongodb/src/test/java/org/apache/zest/entitystore/mongodb/MongoMapEntityStoreTest.java ---------------------------------------------------------------------- diff --git a/extensions/entitystore-mongodb/src/test/java/org/apache/zest/entitystore/mongodb/MongoMapEntityStoreTest.java b/extensions/entitystore-mongodb/src/test/java/org/apache/zest/entitystore/mongodb/MongoMapEntityStoreTest.java index 9c87a47..b7cf7b1 100644 --- a/extensions/entitystore-mongodb/src/test/java/org/apache/zest/entitystore/mongodb/MongoMapEntityStoreTest.java +++ b/extensions/entitystore-mongodb/src/test/java/org/apache/zest/entitystore/mongodb/MongoMapEntityStoreTest.java @@ -20,6 +20,7 @@ package org.apache.zest.entitystore.mongodb; import com.mongodb.Mongo; +import org.apache.zest.entitystore.mongodb.assembly.MongoDBEntityStoreAssembler; import org.junit.BeforeClass; import org.apache.zest.api.common.Visibility; import org.apache.zest.bootstrap.AssemblyException; @@ -57,7 +58,7 @@ public class MongoMapEntityStoreTest new OrgJsonValueSerializationAssembler().assemble( module ); // START SNIPPET: assembly - new MongoMapEntityStoreAssembler().withConfig( config, Visibility.layer ).assemble( module ); + new MongoDBEntityStoreAssembler().withConfig( config, Visibility.layer ).assemble( module ); // END SNIPPET: assembly MongoEntityStoreConfiguration mongoConfig = config.forMixin( MongoEntityStoreConfiguration.class ).declareDefaults(); http://git-wip-us.apache.org/repos/asf/zest-java/blob/78e20260/extensions/entitystore-mongodb/src/test/java/org/apache/zest/entitystore/mongodb/MongoMapEntityStoreWithCacheTest.java ---------------------------------------------------------------------- diff --git a/extensions/entitystore-mongodb/src/test/java/org/apache/zest/entitystore/mongodb/MongoMapEntityStoreWithCacheTest.java b/extensions/entitystore-mongodb/src/test/java/org/apache/zest/entitystore/mongodb/MongoMapEntityStoreWithCacheTest.java index 600e718..b7355a4 100644 --- a/extensions/entitystore-mongodb/src/test/java/org/apache/zest/entitystore/mongodb/MongoMapEntityStoreWithCacheTest.java +++ b/extensions/entitystore-mongodb/src/test/java/org/apache/zest/entitystore/mongodb/MongoMapEntityStoreWithCacheTest.java @@ -20,6 +20,7 @@ package org.apache.zest.entitystore.mongodb; import com.mongodb.Mongo; +import org.apache.zest.entitystore.mongodb.assembly.MongoDBEntityStoreAssembler; import org.junit.BeforeClass; import org.apache.zest.api.common.Visibility; import org.apache.zest.bootstrap.AssemblyException; @@ -54,7 +55,7 @@ public class MongoMapEntityStoreWithCacheTest new OrgJsonValueSerializationAssembler().assemble( module ); - new MongoMapEntityStoreAssembler().withConfig( config, Visibility.layer ).assemble( module ); + new MongoDBEntityStoreAssembler().withConfig( config, Visibility.layer ).assemble( module ); MongoEntityStoreConfiguration mongoConfig = config.forMixin( MongoEntityStoreConfiguration.class ).declareDefaults(); mongoConfig.writeConcern().set( MongoEntityStoreConfiguration.WriteConcern.FSYNC_SAFE ); http://git-wip-us.apache.org/repos/asf/zest-java/blob/78e20260/tools/generator-zest/app/index.js ---------------------------------------------------------------------- diff --git a/tools/generator-zest/app/index.js b/tools/generator-zest/app/index.js index 92eea14..10de705 100644 --- a/tools/generator-zest/app/index.js +++ b/tools/generator-zest/app/index.js @@ -68,7 +68,7 @@ module.exports = generators.Base.extend( 'Jdbm', 'LevelDB', 'Memory', - 'MongoDb', + 'MongoDB', 'Preferences', 'Redis', 'RiakHttp',
