Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 80900200B7F for ; Sun, 28 Aug 2016 02:50:47 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 7F031160AB2; Sun, 28 Aug 2016 00:50:47 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 9F028160AB0 for ; Sun, 28 Aug 2016 02:50:46 +0200 (CEST) Received: (qmail 36477 invoked by uid 500); 28 Aug 2016 00:50:45 -0000 Mailing-List: contact dev-help@zest.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@zest.apache.org Delivered-To: mailing list dev@zest.apache.org Received: (qmail 36465 invoked by uid 99); 28 Aug 2016 00:50:45 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 28 Aug 2016 00:50:45 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 321E2180481 for ; Sun, 28 Aug 2016 00:50:45 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.299 X-Spam-Level: * X-Spam-Status: No, score=1.299 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.001, HTML_MESSAGE=2, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd3-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id 9s-IDHd_Nwdh for ; Sun, 28 Aug 2016 00:50:41 +0000 (UTC) Received: from mail-oi0-f47.google.com (mail-oi0-f47.google.com [209.85.218.47]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id 8CF285F30A for ; Sun, 28 Aug 2016 00:50:40 +0000 (UTC) Received: by mail-oi0-f47.google.com with SMTP id c15so156081479oig.0 for ; Sat, 27 Aug 2016 17:50:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to; bh=iy2EhYmig7dTh8mQ5Oj7SFh8EwQ5Bd7ZvlW5ixwwjfY=; b=qkLN0J6wI9UaM8b89S7hvkUDM4frac4xuaJ3wdMTOsrgkJeSuHt8nFzNpvAgNcf4Tj eknJGaW8DlpXPUseAjFT9UvFVu/5A6WRKFwnlpswuKpaBUGeWbIl7KF21P2GKH4MoZA9 UbCA6acNKphIM7YTdAZzPz2AJfxW40PlASbYzfPgRGMG/tX6ov5rx1BGPWuu68Nbp8br L5veSg3mJIhDdFXPurNH40shZwW61Kw4W1EcsU569uJQ6vaP0HQ7FnAFzssYI99xnYsv 3QI/p6xaFLFy1x9bZkC0bYELKuSEpd/iZHf7UvLdSvUCZ1FdX4TmOqFO7tGpLnfnPtYe Qp/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to; bh=iy2EhYmig7dTh8mQ5Oj7SFh8EwQ5Bd7ZvlW5ixwwjfY=; b=AhOrhMKuUoAM7nXe7A2jfI6i1X43Go81erujhqR8EhJWiGmSzeM8oGfXx/QPLXj1Tg JNXnsffA3w1x0YoH/ZnSlrc5G1v0EDOayA19Fp1D1eqMjlbWKqTYDDK2BLVc0Ufr/zUS 6CvvZX7KIO8XD/oui70bed9bJd1FO5GCu81Ib0k8Pb4Wb9cyRa8ZUdUHQrJn8JsW64a5 95QeCKQil1benzlfMsp5nIbYjaehGaTR+CCAOvw+3DUNeR6DcWabPVIW936FeVrux4Sh qr6srWSzBd4wU2l0oYmlltkoX4cIg60rw/UyT59SOYeg4joychcEh+pwywCoX+WZ5RHT sBuA== X-Gm-Message-State: AE9vXwP5dcbijGZe4ubGIQEDcL82PPWiRbGdNQi75LBb5PA20wMqJs495TLiSqgFMVCaHuDLgTGsd+S1j1ghyA== X-Received: by 10.202.170.212 with SMTP id t203mr6943074oie.135.1472345439028; Sat, 27 Aug 2016 17:50:39 -0700 (PDT) MIME-Version: 1.0 Sender: hedhman@gmail.com Received: by 10.202.51.136 with HTTP; Sat, 27 Aug 2016 17:50:18 -0700 (PDT) In-Reply-To: References: From: Niclas Hedhman Date: Sun, 28 Aug 2016 08:50:18 +0800 X-Google-Sender-Auth: 4wDfLcfJnNoUBlLOBE-zI25s15o Message-ID: Subject: Re: Entity Store To: dev Content-Type: multipart/alternative; boundary=001a113c356ae14b01053b1722ad archived-at: Sun, 28 Aug 2016 00:50:47 -0000 --001a113c356ae14b01053b1722ad Content-Type: text/plain; charset=UTF-8 Hi, In 2.1 and earlier, the assembly was quite tedious and error-prone. For the 'develop' branch (to become 3.0), we are working at making it easier. 1. The LayeredApplicationAssembler with its associated LayerAssembler and ModuleAssembler, tries to make it a lot easier (and keep it a lot neater) to create layered application assembly. See https://zest.apache.org/java/2.1/core-bootstrap-assembly.html and find section "Layered Application Assembler (RECOMMENDED)" 2. I am currently working on a Yeoman generator, which will set up the application skeleton using the LayeredApplicationAssembler mentioned above. Answer a couple of questions and you have a project structure, build system and possibly an sample application created for you. This needs help to test out and expand. See below what is generated at the moment, incl a "heroes" webapp sample 3. In general, I am against scanning for classes, as it both slows everything down and that it becomes unpredictable and fragile. Ok, so for MongoDB you do two things, 1. You need to use an assembler and do something like this; public class MongoDBStorageModule implements ModuleAssembler { public static final String NAME = "MongoDB Storage Module"; private final ModuleAssembly configModule; public MongoDBStorageModule( ModuleAssembly configModule ) { this.configModule = configModule; } @Override public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module ) throws AssemblyException { module.withDefaultUnitOfWorkFactory(); new MongoDBEntityStoreAssembler() .visibleIn( Visibility.application ) .withConfig( configModule, Visibility.application ) .identifiedBy( "MongoDBstore" ) .assemble( module ); return module; } } (The above is generated in my new Yeoman generator) The identifiedBy("MongoDBstore") is the key to find the bootstrap configuration for the service. If you look at org.apache.zest.entitystore.mongodb.MongoEntityStoreConfiguration it contains the configuration that has been made available. Configuration can be initialized from files in the classpath, and the location is from the identifiedBy() above. We are trying to support properties, json, yaml and xml files as the configuration bootstrap format. So you could create a MongoDBstore.json file with the following content; { "hostname" : "n1.hedhman.org", "port" : 27017, "username" : "mongo", "password" : "secret", "database" : "heroes_app", "collection" : "heroes", "writeConcern" : "NORMAL" } I just realize that the nodes() property in the configuration can probably not be initialized from file at the moment, as it takes a ServerAddress list as argument. That should be fixed... A general note though; Be careful with MongoDB... It is not particularly resilient to failures. Hope this helps. -o-o-o-o-o- niclas-249:heroes2 niclas$ find . . ./app ./app/build.gradle ./app/src ./app/src/main ./app/src/main/java ./app/src/main/java/heroes2 ./app/src/main/java/heroes2/app ./app/src/main/java/heroes2/app/Heroes.java ./app/src/main/webapp ./app/src/main/webapp/app ./app/src/main/webapp/app/app.component.css ./app/src/main/webapp/app/app.component.js ./app/src/main/webapp/app/app.component.js.map ./app/src/main/webapp/app/app.component.ts ./app/src/main/webapp/app/dashboard.component.css ./app/src/main/webapp/app/dashboard.component.html ./app/src/main/webapp/app/dashboard.component.js ./app/src/main/webapp/app/dashboard.component.js.map ./app/src/main/webapp/app/dashboard.component.ts ./app/src/main/webapp/app/hero-detail.component.css ./app/src/main/webapp/app/hero-detail.component.html ./app/src/main/webapp/app/hero-detail.component.js ./app/src/main/webapp/app/hero-detail.component.js.map ./app/src/main/webapp/app/hero-detail.component.ts ./app/src/main/webapp/app/hero.js ./app/src/main/webapp/app/hero.js.map ./app/src/main/webapp/app/hero.service.js ./app/src/main/webapp/app/hero.service.js.map ./app/src/main/webapp/app/hero.service.ts ./app/src/main/webapp/app/hero.ts ./app/src/main/webapp/app/heroes.component.css ./app/src/main/webapp/app/heroes.component.html ./app/src/main/webapp/app/heroes.component.js ./app/src/main/webapp/app/heroes.component.js.map ./app/src/main/webapp/app/heroes.component.ts ./app/src/main/webapp/app/main.js ./app/src/main/webapp/app/main.js.map ./app/src/main/webapp/app/main.ts ./app/src/main/webapp/app/mock-heroes.js ./app/src/main/webapp/app/mock-heroes.js.map ./app/src/main/webapp/app/mock-heroes.ts ./app/src/main/webapp/index.html ./app/src/main/webapp/styles.css ./app/src/main/webapp/WEB-INF ./app/src/main/webapp/WEB-INF/web.xml ./bootstrap ./bootstrap/build.gradle ./bootstrap/src ./bootstrap/src/main ./bootstrap/src/main/java ./bootstrap/src/main/java/heroes2 ./bootstrap/src/main/java/heroes2/bootstrap ./bootstrap/src/main/java/heroes2/bootstrap/config ./bootstrap/src/main/java/heroes2/bootstrap/config/ConfigModule.java ./bootstrap/src/main/java/heroes2/bootstrap/config/ConfigurationLayer.java ./bootstrap/src/main/java/heroes2/bootstrap/connectivity ./bootstrap/src/main/java/heroes2/bootstrap/connectivity/ConnectivityLayer.java ./bootstrap/src/main/java/heroes2/bootstrap/connectivity/RestApiModule.java ./bootstrap/src/main/java/heroes2/bootstrap/domain ./bootstrap/src/main/java/heroes2/bootstrap/domain/CrudModule.java ./bootstrap/src/main/java/heroes2/bootstrap/domain/DomainLayer.java ./bootstrap/src/main/java/heroes2/bootstrap/domain/SecurityModule.java ./bootstrap/src/main/java/heroes2/bootstrap/HeroesApplicationAssembler.java ./bootstrap/src/main/java/heroes2/bootstrap/infrastructure ./bootstrap/src/main/java/heroes2/bootstrap/infrastructure/FileConfigurationModule.java ./bootstrap/src/main/java/heroes2/bootstrap/infrastructure/InfrastructureLayer.java ./bootstrap/src/main/java/heroes2/bootstrap/infrastructure/JacksonSerializationModule.java ./bootstrap/src/main/java/heroes2/bootstrap/infrastructure/MongoDBStorageModule.java ./bootstrap/src/main/java/heroes2/bootstrap/infrastructure/NoCachingModule.java ./bootstrap/src/main/java/heroes2/bootstrap/infrastructure/RdfIndexingModule.java ./build.gradle ./gradle ./gradle/wrapper ./gradle/wrapper/gradle-wrapper.jar ./gradle/wrapper/gradle-wrapper.properties ./gradlew ./gradlew.bat ./model ./model/build.gradle ./model/src ./model/src/main ./model/src/main/java ./model/src/main/java/heroes2 ./model/src/main/java/heroes2/model ./model/src/main/java/heroes2/model/heroes ./model/src/main/java/heroes2/model/heroes/Hero.java ./model/src/main/java/heroes2/model/security ./model/src/main/java/heroes2/model/security/HardcodedSecurityRepositoryMixin.java ./model/src/main/java/heroes2/model/security/SecurityRepository.java ./rest ./rest/build.gradle ./rest/src ./rest/src/main ./rest/src/main/java ./rest/src/main/java/heroes2 ./rest/src/main/java/heroes2/rest ./rest/src/main/java/heroes2/rest/security ./rest/src/main/java/heroes2/rest/security/SimpleEnroler.java ./rest/src/main/java/heroes2/rest/security/SimpleVerifier.java ./settings.gradle On Sun, Aug 28, 2016 at 5:45 AM, Prince Arora wrote: > Hi Everyone, > > I just started using zest and creating an application with MongoDB as data > storage. I have gone through the documentations Its all good i understood > the consent of application, mixins, concerns and all. But not sure how i > can configure and entity store using Mongodb extension. How do i define the > mongo connections configurations for Mongo assembler? > > I have gone through Zest core apis and documents and seems a good framework > to develop applications. The only thing that can be a pain is the > Application assembly. As the applications goes bigger the assembly will get > more harder to manage for developers as we have to add all entities, > concerns and everything we are using inside our application/module. Are we > developing any configurations system to assemble applications or do we have > one? And also we can make it easier if we add an option register these > composites with package name. Like for entity one can give a package name > where we can scan all the entities and register them for that module. It is > just a suggestion though. Let me know what others think about this. > > I will keep working on this and will write if i find any other issue or > suggestions. Since this is my first contribution to a open source project i > will not be much of help in starting and plus i am also learning zest from > scratch but i will try my best to contribute as much as i can. > > > Thanks, > -- Niclas Hedhman, Software Developer http://zest.apache.org - New Energy for Java --001a113c356ae14b01053b1722ad--