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 03F33200C83 for ; Sun, 28 May 2017 11:59:58 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 02823160BCC; Sun, 28 May 2017 09:59:58 +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 20EBF160BB1 for ; Sun, 28 May 2017 11:59:56 +0200 (CEST) Received: (qmail 28292 invoked by uid 500); 28 May 2017 09:59:56 -0000 Mailing-List: contact dev-help@polygene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@polygene.apache.org Delivered-To: mailing list dev@polygene.apache.org Received: (qmail 28280 invoked by uid 99); 28 May 2017 09:59:56 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 28 May 2017 09:59:56 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 9BE4AC31BB for ; Sun, 28 May 2017 09:59:55 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.48 X-Spam-Level: ** X-Spam-Status: No, score=2.48 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_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_SORBS_SPAM=0.5, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd1-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 (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id 0G70nR49qdmE for ; Sun, 28 May 2017 09:59:53 +0000 (UTC) Received: from mail-lf0-f44.google.com (mail-lf0-f44.google.com [209.85.215.44]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id AB9905F297 for ; Sun, 28 May 2017 09:59:52 +0000 (UTC) Received: by mail-lf0-f44.google.com with SMTP id 99so22618256lfu.1 for ; Sun, 28 May 2017 02:59:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to; bh=+28mLjsiFqR3QLen0GHR5Oke1CTBttvdYrJ9loI6o7g=; b=V6uMx639Nkv71i/mP2l/6Iq8he1cQnLUlOPOKM0ZivjIoeOrGu/YgvPJ8hEaBDJDDY qtPYYjnTuiSBZAuCL9Bfaq/ooEwVbbfCINb5VHd6XzTmTTi122HEuzPP0quHKe2LXMWF ReEad2mF4SHTTcwmVV785CmkGjOVL8SnVpK0MZqRLkmGhh7zPWjYsFpbdBsstDcwGQrD H5rSXiCMW4BGdpJZg8B6j1T+d9OQBClmXx9Dez6w95t4YWXVAeG/xAij/sCpM6lf4/3A KCQeUxaL4Zo3yQnYGo/NswKQnsfqpC+mr9RpkQPYWeNniQrBtdXnNyDX948+lDxS39i7 LyGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to; bh=+28mLjsiFqR3QLen0GHR5Oke1CTBttvdYrJ9loI6o7g=; b=VdPdazde5KyafX2ikO38lDuejNPU4hiqw9aAbOjQH5RQBPczfIKvRb/cmuxOyHeMh1 UkqCx4oe+B9RQzEA9Tb0QZzzXjR9Jh5x98QxLlCRnCkv+TgGVQfFw93tLKhEccmUs0eN q2dGXN4opOiTzdqgCZG423DSVzt10oNDwPM2vmxcZxxCfeWasXz6i1LHoDJWbHKWTB/U YwsQjpWDKE1845HhHOO6Yj0Wxv5Z3IEiIPyIHXEBi5Q0947AXtNf14cacDLfCLPEqLO0 IrXsbgnRSy0PD8royyodXXewj3CHEkv7VA+qQkouGWeBiSwKQatV5ZouUjVM5/mWzAGT wi7g== X-Gm-Message-State: AODbwcBVOYyw1ZrlQXMLDM4OsBg1pZb2oDL6284F+lYf47Z5UFKKCWtu so1kVJyAboCs1UDxRQwMexJiyJIEAw== X-Received: by 10.25.17.39 with SMTP id g39mr2809116lfi.122.1495965585794; Sun, 28 May 2017 02:59:45 -0700 (PDT) MIME-Version: 1.0 Sender: hedhman@gmail.com Received: by 10.46.83.28 with HTTP; Sun, 28 May 2017 02:59:25 -0700 (PDT) In-Reply-To: References: From: Niclas Hedhman Date: Sun, 28 May 2017 17:59:25 +0800 X-Google-Sender-Auth: ZlgjjFRIcUvaNgDMHmCS4T6am1g Message-ID: Subject: Re: Visibility, again... To: dev@polygene.apache.org Content-Type: multipart/alternative; boundary="001a11407f24566dc5055092a127" archived-at: Sun, 28 May 2017 09:59:58 -0000 --001a11407f24566dc5055092a127 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Indexers used to have some inconsistency, but I don't recall what. After all, they only return the Entity Reference, and the caller will end up loading the entities. "Home Service" ? End of the day, for domain models, I tend to end up with entities in Visibility.module, only accessible by services in that module, and if the entities are used elsewhere, to expose via that service. I think that works well. My struggle at the moment is the balancing act of the Infra+Config setup; * Caching, Indexers and EntityStores uses configuration * UnitOfWork uses Caching and EntityStores * Configuration uses UnitOfWork and Serialization And to get that right for the Yeoman generator, in all cases has surfaced the peculiarity of Deserializer visible from the ServiceComposite is used to initially populate the Configuration, but the Configuration entity's module is used to persist it. Niclas On Sun, May 28, 2017 at 5:44 PM, Kent S=C3=B8lvsten wrote: > Regarding the description below (which entitystore is used), I recall > looking at this a year or 2 ago, coming to more or less the same > conclusion: > *The EntityStore closest to the location of the model itself is used* > (i even recall filing a JIRA issue regarding an inconsistency, since > this is not the case for indexers/querying). > > I agree it is generally a good, consistent principle: The model is King! > > I imagine something like a (possibly hidden to application code) "Home > service" existing for each model, responsible for saving, finding and > loading entities of a specific type. > And with that mental image I think it makes sense using the entitystore, > and the (de)serializer nearest to that imaginary HomeService (and thus > to the model). > And the same should go for the querying/indexing stuff. > > I sense some refactorings and possibly deprecations coming up, during > 3.1, 3.2 releases ..... > > /Kent > > > Den 28-05-2017 kl. 10:50 skrev Niclas Hedhman: > > Ok, > > I have figured out why I ended up writing the above. > > > > There is a small inconsistency when it comes to Configuration. > > > > ConfigurationComposites as they are formally called, is a subtype of > > EntityComposite that is tied to a ServiceComposite, and can be > > pre-populated with values from other sources, such as properties files. > > > > Now, if I register the ConfigurationComposite in Config Module/Layer, t= he > > ConfigurationMixin will use the Module of the ServiceComposite to locat= e > > deserializer when reading those external files. > > > > I think the consistent behavior should be that the Deserializer visible > > from the module of the ConfigurationComposite should be used. > > > > > > WDYT? > > > > > > Niclas > > > > On Sun, May 28, 2017 at 1:45 PM, Niclas Hedhman > wrote: > > > >> Hi, > >> > >> ( If someone wants low-hanging fruit; Take the information below, and > >> rewrite it as documentation in markdown, under some internal-ish page. > Or, > >> extract what the user really need to know and check that we have that > >> documented already or add it.) > >> > >> I am getting more and more uncertain on how the Visibility rules work. > >> This mail is writing my notes trying to figure out what actually > happens, > >> and whether that is semantically correct. > >> > >> Let's say we have; > >> > >> Connectivity Layer > >> MemoryEntityStore > >> Restlet does a newUnitOfWork() > >> > >> Service Layer > >> FileEntityStore > >> DomainService doing uow.get( DomainEntity.class, "123" ) > >> > >> Domain Layer > >> JdbmEntityStore visibiliy application > >> DomainEntity > >> > >> Infrastructure Layer > >> LevelDBEntityStore > >> > >> And all of them have the DefaultUnitOfWorkAssembler in effect. > >> > >> > >> So, from which EnittyStore will the entity be read from? > >> > >> > >> Connectivity Layer =3D=3D?, the Restlet would have a module local > >> UnitOfWorkFactory which will create a UnitOfWorkInstance with > "Connectivity > >> Layer" as Module argument. It will also create a ModuleUnitOfWork as a > >> Transient and therefor receive ModuleDescriptor for Connectivity Layer= . > >> > >> > >> Service Layer =3D=3D> The DomainService will do call its UnitOfWorkFac= tory, > >> which will "find" the UnitOfWorkInstance from above (with the > Connectivity > >> Layer module in it) and then instantiate a new ModuleUnitOfWork, which > will > >> have the ModuleDescriptor of Service Layer > >> > >> > >> Domain and Infrastructure Layers =3D=3D> are totally passive. > >> > >> > >> So what happens at uow.get() in DomainService? > >> > >> EntityDescriptor for DomainEntity is looked up inside ModuleUnitOfWork > in > >> Service Layer, useing the module in Service Layer as visibility > argument. > >> I.e. the DomainEntity must be Visibility.application. > >> > >> Then UnitOfWorkInstance.get() is called, with identity, potentialModel= s > >> and the ModuelUnitOfWork as arguments. It loops through the potential > >> models, takes the Module in these, creates a EnityStoreUnitOfWork with > that > >> EntityStore and tries to load the state. If successful create a > >> EntityInstance with this; > >> > >> model =3D (EntityModel) entityState.entityDescriptor(); > >> > >> entityInstance =3D new EntityInstance( uow, model, entityState ); > >> > >> > >> where uow is the ModuleUnitOfWork, i.e. from the module in the Service > >> Layer and the model containing a Module of potentialModel > >> selected/successful. > >> > >> > >> So, my conclusion is; it seems that the Entity Store that is visible = to > >> the DomainEntity will be used... And that is what I think has been the > >> intention all the while since back in 2007/2008 somewhere when the > >> Visibility design was utterly flawed in the first iteration of Qi4j (t= he > >> above would require the Restlet to see everything). > >> > >> > >> > >> > >> -- > >> Niclas Hedhman, Software Developer > >> http://polygene.apache.org - New Energy for Java > >> > > > > > > --=20 Niclas Hedhman, Software Developer http://polygene.apache.org - New Energy for Java --001a11407f24566dc5055092a127--