polygene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Niclas Hedhman <nic...@hedhman.org>
Subject Re: MongoDB Entity Store
Date Fri, 05 May 2017 12:29:19 GMT
Yes, the registration of values(ServerAddress.class) should not be there.
That was an oversight on my behalf.

A few things that could be a work-around.

1. Create a Concern that intercepts the configuration and populates the
nodes. You add the Concern in your own Assembler (copy source from
MongoDbEntityStoreAssembler), so instead of;

ServiceDeclaration service = module
        .services( MongoMapEntityStoreService.class )
        .visibleIn( visibility() );

add the Concern as;

ServiceDeclaration service = module
        .services( MongoMapEntityStoreService.class )
        .withConcerns( MyConfigurationConcern.class )
        .visibleIn( visibility() );


Then your MyConfigurationConcern would be something like;

public abstract class MyConfigurationConcern extends
ConcernOf<Configuration<MongoEntityStoreConfiguration>>
    implements Configuration<MongoEntityStoreConfiguration>
{
    @Override
    public MongoEntityStoreConfiguration get()
    {
        MongoEntityStoreConfiguration conf = next.get();
        conf.nodes().set( MY_NODES );
        return conf;
    }
}


2. Maybe you want your own Configuration store. Create (or use) an Entity
Store that does not require any Polygene Configuration, and drop that into
the Configuration Module. Perhaps read configuration from "Java
Preferences", maybe a configured Zookeeper cluster or maybe ETCD. And if
the configuration entity store is populated, then there will be no fallback
to properties/yaml files.
This is of course a fairly advanced option, but I would recommend it for
production setup.


But I am sure Paul will say; "Just ..."  :-)

Cheers
Niclas

On Fri, May 5, 2017 at 7:55 PM, Apostolos Krionidis <aldrigmej@yahoo.gr>
wrote:

> Yes you are right ServerAddress is a Immutable POJO but here the problem
> seems to by before
> json serialization, in ValueComposite registration.
>
> Is there any other way to set prices in the nodes() property after the
> .property file loading?
>
>
>
>
> Στις 2:44 μ.μ. Παρασκευή, 5 Μαΐου 2017, ο/η Niclas Hedhman <
> niclas@hedhman.org> έγραψε:
>
>
> Of course... ServerAddress is a pojo, and it doesn't have a POJO
> compatible format for Jackson et al.
>
> Paul, how was this supposed to work?
>
> Cheers
>
>
> --
> Niclas Hedhman, Software Developer
> http://polygene.apache.org - New Energy for Java
>
>
>


-- 
Niclas Hedhman, Software Developer
http://polygene.apache.org - New Energy for Java

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message