Hello Val,

Thank you for your prompt reply. 

After responding to another issue you replied (Help with Integrating Ignite… 
with JBoss…) I don’t know how easy would be to describe an IgniteConfiguration 
object as a JSON string. As you mentioned in that reply, there are many 
factories, SPIs, etc. that are properties themselves.

I think the main reason for having a JSON configuration of Ignite would be to 
avoid the use of Spring for configuration but seeing how the 
IgniteConfiguration class (and its dependents) don’t really follow a JavaBean 
approach, I don’t think it would be a good candidate for JSON deserialization.

One of the issues (and I think in this case you have no control over it) I ran 
into was that CacheConfiguration extends MutableConfiguration (from JCache) and 
MutableConfiguration’s expiryPolicyFactory is set at construction time to 
EternalExpiryPolicy.factoryOf() which itself returns a 
FactoryBuilder.SingletonFactory that does not have a default constructor. 

Another issue was with the DiscoverySpi configuration whose concrete 
implementation class TcpDiscoverySpi has many getter methods that when called 
raise an NPE (e.g. getRemoteNodes() ) and the reason for this, is that a 
TcpDiscoverySpi is not really ready until its spiStart method is called, which 
a JSON Serializer would not know about that.

Having said all this, I am going to open a ticket to request that Ignite itself 
provides some utility class/method that returns an IgniteConfiguration from a 
JSON string and generates a JSON from an IgniteConfiguration. It would be left 
to the implementors of the feature to determine how to specify the JSON string 
for deserialization and/or other restrictions/constraints/pre-requisites 
necessary for it to work correctly.

Thanks - Juan

> On Dec 7, 2015, at 1:20 PM, vkulichenko <valentin.kuliche...@gmail.com> wrote:
> 
> Juan,
> 
> Currently there is no support for this, but I believe it can be added. Would
> you mind to create a ticket and share your thoughts on how this feature
> should look like?
> 
> -Val
> 
> 
> 
> --
> View this message in context: 
> http://apache-ignite-users.70518.x6.nabble.com/How-to-serialize-deserialize-IgniteConfiguration-to-from-JSON-tp2164p2167.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Reply via email to