Re: [IGNITE-12582] Configuration by property

2020-02-04 Thread Sergey Chernolyas
Ivan,

Thanks. I have answered.


On Tue, 4 Feb 2020 at 15:03, Ivan Pavlukhin  wrote:

> Sergey,
>
> Thank you for your efforts! I left some comments in the ticket [1].
>
> [1] https://issues.apache.org/jira/browse/IGNITE-12582
>
> сб, 1 февр. 2020 г. в 18:35, Sergey Chernolyas <
> sergey.chernol...@gmail.com>:
> >
> > Hi Ivan!
> >
> > https://github.com/apache/ignite/pull/7347 . It is link to PR.
> Criticism
> > is welcome :-)
> >
> > On Sat, 1 Feb 2020 at 18:15, Ivan Pavlukhin  wrote:
> >
> > > Sergey,
> > >
> > > Could you please share your prototype, I would like to have a look.
> > >
> > > сб, 1 февр. 2020 г. в 16:59, schernolyas  >:
> > > >
> > > > Hi Ivan !
> > > >
> > > > Yes, I have the prototype.  Right now, main question is can we remove
> > > spring
> > > > data modules into project with extensions for Ignite.
> > > >
> > > >
> > > >
> > > > --
> > > > Sent from: http://apache-ignite-developers.2346864.n4.nabble.com/
> > >
> > >
> > >
> > > --
> > > Best regards,
> > > Ivan Pavlukhin
> > >
> >
> >
> > --
> > -
> >
> > With best regards, Sergey Chernolyas
>
>
>
> --
> Best regards,
> Ivan Pavlukhin
>


-- 
-

With best regards, Sergey Chernolyas


Re: [IGNITE-12582] Configuration by property

2020-02-04 Thread Ivan Pavlukhin
Sergey,

Thank you for your efforts! I left some comments in the ticket [1].

[1] https://issues.apache.org/jira/browse/IGNITE-12582

сб, 1 февр. 2020 г. в 18:35, Sergey Chernolyas :
>
> Hi Ivan!
>
> https://github.com/apache/ignite/pull/7347 . It is link to PR.  Criticism
> is welcome :-)
>
> On Sat, 1 Feb 2020 at 18:15, Ivan Pavlukhin  wrote:
>
> > Sergey,
> >
> > Could you please share your prototype, I would like to have a look.
> >
> > сб, 1 февр. 2020 г. в 16:59, schernolyas :
> > >
> > > Hi Ivan !
> > >
> > > Yes, I have the prototype.  Right now, main question is can we remove
> > spring
> > > data modules into project with extensions for Ignite.
> > >
> > >
> > >
> > > --
> > > Sent from: http://apache-ignite-developers.2346864.n4.nabble.com/
> >
> >
> >
> > --
> > Best regards,
> > Ivan Pavlukhin
> >
>
>
> --
> -
>
> With best regards, Sergey Chernolyas



-- 
Best regards,
Ivan Pavlukhin


Re: [IGNITE-12582] Configuration by property

2020-02-01 Thread Sergey Chernolyas
Hi Ivan!

https://github.com/apache/ignite/pull/7347 . It is link to PR.  Criticism
is welcome :-)

On Sat, 1 Feb 2020 at 18:15, Ivan Pavlukhin  wrote:

> Sergey,
>
> Could you please share your prototype, I would like to have a look.
>
> сб, 1 февр. 2020 г. в 16:59, schernolyas :
> >
> > Hi Ivan !
> >
> > Yes, I have the prototype.  Right now, main question is can we remove
> spring
> > data modules into project with extensions for Ignite.
> >
> >
> >
> > --
> > Sent from: http://apache-ignite-developers.2346864.n4.nabble.com/
>
>
>
> --
> Best regards,
> Ivan Pavlukhin
>


-- 
-

With best regards, Sergey Chernolyas


Re: [IGNITE-12582] Configuration by property

2020-02-01 Thread Ivan Pavlukhin
Sergey,

Could you please share your prototype, I would like to have a look.

сб, 1 февр. 2020 г. в 16:59, schernolyas :
>
> Hi Ivan !
>
> Yes, I have the prototype.  Right now, main question is can we remove spring
> data modules into project with extensions for Ignite.
>
>
>
> --
> Sent from: http://apache-ignite-developers.2346864.n4.nabble.com/



-- 
Best regards,
Ivan Pavlukhin


Re: [IGNITE-12582] Configuration by property

2020-02-01 Thread schernolyas
Hi Ivan !

Yes, I have the prototype.  Right now, main question is can we remove spring
data modules into project with extensions for Ignite.



--
Sent from: http://apache-ignite-developers.2346864.n4.nabble.com/


Re: [IGNITE-12582] Configuration by property

2020-01-31 Thread Ivan Pavlukhin
Sergey,

I understand and support the proposed idea. Just curious how to
implement it. Do you already have some prototype?

пт, 31 янв. 2020 г. в 11:48, schernolyas :
>
> Hi!
>
> It is proposed to use the same annotation(RepositoryConfig). But value of
> field "cacheName"  can be constant or Spring EL expression.
> Correct cases are:
> 1) By Spring EL expression
> @Repository
> @RepositoryConfig(cacheName = "@cacheNames.calendarCacheName")
> public interface CalendarRepository extends IgniteRepository String> {
> List findByName(String name);
> }
> 2) By constant
> @Repository
> @RepositoryConfig(cacheName = "Calendar")
> public interface CalendarRepository extends IgniteRepository String> {
> List findByName(String name);
> }
>
> Any other ideas?
>
>
>
> --
> Sent from: http://apache-ignite-developers.2346864.n4.nabble.com/



-- 
Best regards,
Ivan Pavlukhin


Re: [IGNITE-12582] Configuration by property

2020-01-31 Thread schernolyas
Hi!

It is proposed to use the same annotation(RepositoryConfig). But value of
field "cacheName"  can be constant or Spring EL expression.
Correct cases are:
1) By Spring EL expression
@Repository
@RepositoryConfig(cacheName = "@cacheNames.calendarCacheName")
public interface CalendarRepository extends IgniteRepository {
List findByName(String name);
}
2) By constant
@Repository
@RepositoryConfig(cacheName = "Calendar")
public interface CalendarRepository extends IgniteRepository {
List findByName(String name);
}

Any other ideas?



--
Sent from: http://apache-ignite-developers.2346864.n4.nabble.com/


Re: [IGNITE-12582] Configuration by property

2020-01-31 Thread Ivan Pavlukhin
Sergey,

Supporting SpEL sounds quite good. Just out of curiosity, how are you
going to evaluate SpEL from a custom annotation?

P.S. I noticed al least 3 mail threads with a name "[IGNITE-12582]
Configuration by property". Please keep the discussion in the same
mail thread.

чт, 30 янв. 2020 г. в 18:23, Seliverstov Igor :
>
> Isn't a better way just to add a new annotation?
>
> Like RepositoryConfig but from v2 package for example.
>
> This case whose who already use it won't suffer.
>
> Also it's would be great to provide a way to escape constants which are
> similar to spel expressions.
>
> Regards,
> Igor
>
> чт, 30 янв. 2020 г., 13:18 Sergey Chernolyas :
>
> > Hi igniters!
> >
> > Presently, Spring Data for Ignite can't be configured dynamically. I mean ,
> > than I defines repository by the code:
> >
> > @Repository
> > @RepositoryConfig(cacheName = "Calendar")
> > public interface CalendarRepository extends IgniteRepository > String> {
> > List findByName(String name);
> > }
> >
> > But I need to configure used cache dynamically ( at runtime). To solve
> > this problem is proposed to use Spring Expression Language. By the
> > way, I will have possibility to use the code:
> >
> > @Repository
> > @RepositoryConfig(cacheName = "${cache.calendar.name}")
> > public interface CalendarRepository extends IgniteRepository > String> {
> > List findByName(String name);
> > }
> >
> > And property "cache.calendar.name" can be configured as usual property
> > at Spring Framework.
> >
> > But way brakes current configuration way and I would ask about how we
> > can set cache name by  expression or constant string.
> >
> > I see options:
> >
> > 1) field "cacheName" will be able to process expression and constant
> > string. The code of repository factory will analyse the field.
> >
> > 2) create new field for expressions
> >
> >
> > What is best way?
> >
> >
> > --
> > -
> >
> > With best regards, Sergey Chernolyas
> >



-- 
Best regards,
Ivan Pavlukhin


Re: [IGNITE-12582] Configuration by property

2020-01-30 Thread Seliverstov Igor
Isn't a better way just to add a new annotation?

Like RepositoryConfig but from v2 package for example.

This case whose who already use it won't suffer.

Also it's would be great to provide a way to escape constants which are
similar to spel expressions.

Regards,
Igor

чт, 30 янв. 2020 г., 13:18 Sergey Chernolyas :

> Hi igniters!
>
> Presently, Spring Data for Ignite can't be configured dynamically. I mean ,
> than I defines repository by the code:
>
> @Repository
> @RepositoryConfig(cacheName = "Calendar")
> public interface CalendarRepository extends IgniteRepository String> {
> List findByName(String name);
> }
>
> But I need to configure used cache dynamically ( at runtime). To solve
> this problem is proposed to use Spring Expression Language. By the
> way, I will have possibility to use the code:
>
> @Repository
> @RepositoryConfig(cacheName = "${cache.calendar.name}")
> public interface CalendarRepository extends IgniteRepository String> {
> List findByName(String name);
> }
>
> And property "cache.calendar.name" can be configured as usual property
> at Spring Framework.
>
> But way brakes current configuration way and I would ask about how we
> can set cache name by  expression or constant string.
>
> I see options:
>
> 1) field "cacheName" will be able to process expression and constant
> string. The code of repository factory will analyse the field.
>
> 2) create new field for expressions
>
>
> What is best way?
>
>
> --
> -
>
> With best regards, Sergey Chernolyas
>


[IGNITE-12582] Configuration by property

2020-01-30 Thread Sergey Chernolyas
Hi igniters!

Presently, Spring Data for Ignite can't be configured dynamically. I mean ,
than I defines repository by the code:

@Repository
@RepositoryConfig(cacheName = "Calendar")
public interface CalendarRepository extends IgniteRepository {
List findByName(String name);
}

But I need to configure used cache dynamically ( at runtime). To solve
this problem is proposed to use Spring Expression Language. By the
way, I will have possibility to use the code:

@Repository
@RepositoryConfig(cacheName = "${cache.calendar.name}")
public interface CalendarRepository extends IgniteRepository {
List findByName(String name);
}

And property "cache.calendar.name" can be configured as usual property
at Spring Framework.

But way brakes current configuration way and I would ask about how we
can set cache name by  expression or constant string.

I see options:

1) field "cacheName" will be able to process expression and constant
string. The code of repository factory will analyse the field.

2) create new field for expressions


What is best way?


-- 
-

With best regards, Sergey Chernolyas


[IGNITE-12582] Configuration by property

2020-01-30 Thread Sergey Chernolyas
Hi igniters!

I would ask you to estimate the proposed solution and say how correct is.
It is proposed to set repository name by Spring Expression Language.
But ... it leads one question for discussion.
Where do we need to write the expression?
I see two options:
1) at field "cacheName". The code will analyse type of content (clear
string or expression)
2) at new field.
I mean annotation
https://ignite.apache.org/releases/latest/javadoc/org/apache/ignite/springdata20/repository/config/RepositoryConfig.html


-- 
-

With best regards, Sergey Chernolyas


Re: [IGNITE-12582] Configuration by property

2020-01-29 Thread Sergey Chernolyas
Hi!

Main subject is the example
https://apacheignite-mix.readme.io/docs/spring-data#section-apache-ignite-repository
demonstrates
mapping between particular repository and particular cache  by annotation
"RepositoryConfig".
I need to do it by spring configuration. For example, property "
*spring.data.mongodb.uri*" from spring data repository for mongodb

On Wed, 29 Jan 2020 at 15:16, Sergey Chernolyas 
wrote:

> Hi!
>
>   It is seemed what I need.
>
> On Wed, 29 Jan 2020 at 15:14, Nikolay Izhikov  wrote:
>
>> Hello, Sergey.
>>
>> What is «repository»? How it relates to the Ignite?
>>
>> ignite-spring-boot-autoconfigure confirms your requirements?
>>
>>
>> https://github.com/apache/ignite-extensions/blob/master/modules/spring-boot-autoconfigure/examples/main/resources/application.yml
>>
>> ```
>> ignite:
>>   igniteInstanceName: properties-instance-name
>>   communicationSpi:
>> localPort: 
>>   dataStorageConfiguration:
>> defaultDataRegionConfiguration:
>>   initialSize: 10485760 #10MB
>> dataRegionConfigurations:
>>   - name: my-dataregion
>> initialSize: 104857600 #100MB
>>   cacheConfiguration:
>> - name: accounts
>>   queryEntities:
>>   - tableName: ACCOUNTS
>> keyFieldName: ID
>> keyType: java.lang.Long
>> valueType: java.lang.Object
>> fields:
>>   ID: java.lang.Long
>>   amount: java.lang.Double
>>   updateDate: java.util.Date
>> - name: my-cache2
>> ```
>>
>>
>> > 29 янв. 2020 г., в 15:09, Sergey Chernolyas <
>> sergey.chernol...@gmail.com> написал(а):
>> >
>> > Hi Nikolay!
>> > I need to configure particulate repository by usual Spring configuration
>> > without  using
>> >
>> https://ignite.apache.org/releases/latest/javadoc/org/apache/ignite/springdata20/repository/config/RepositoryConfig.html
>> >
>> > Am I investing to a bicycle?
>> >
>> > On Wed, 29 Jan 2020 at 14:58, Nikolay Izhikov 
>> wrote:
>> >
>> >> Hello, Sergey.
>> >>
>> >> Your proposal is not clear for me
>> >> Can you, please, describe the issue you are trying to solve?
>> >> And the way you want to do it.
>> >>
>> >>
>> >>> 29 янв. 2020 г., в 14:53, Sergey Chernolyas <
>> sergey.chernol...@gmail.com>
>> >> написал(а):
>> >>>
>> >>> Hi!
>> >>> It is proposed to use the structure for configuration.
>> >>>
>> >>> spring.data.ignite:
>> >>>  - name: cache1
>> >>> sqlSchema: schema1
>> >>> atomicityMode: TRANSACTIONAL_SNAPSHOT
>> >>>  - name: cache2
>> >>> sqlSchema: schema2
>> >>> storeKeepBinary: true
>> >>>  - name: cache3
>> >>>sqlQuery: CREATE TABLE IF NOT EXISTS Person (id int, city_id int,
>> >> name
>> >>> varchar, age int,  company varchar, PRIMARY KEY (id, city_id))
>> >>>
>> >>> Other ideas ?
>> >>>
>> >>>
>> >>>
>> >>> --
>> >>> -
>> >>>
>> >>> With best regards, Sergey Chernolyas
>> >>
>> >>
>> >
>> > --
>> > -
>> >
>> > With best regards, Sergey Chernolyas
>>
>>
>
> --
> -
>
> With best regards, Sergey Chernolyas
>


-- 
-

With best regards, Sergey Chernolyas


Re: [IGNITE-12582] Configuration by property

2020-01-29 Thread Sergey Chernolyas
Hi!

  It is seemed what I need.

On Wed, 29 Jan 2020 at 15:14, Nikolay Izhikov  wrote:

> Hello, Sergey.
>
> What is «repository»? How it relates to the Ignite?
>
> ignite-spring-boot-autoconfigure confirms your requirements?
>
>
> https://github.com/apache/ignite-extensions/blob/master/modules/spring-boot-autoconfigure/examples/main/resources/application.yml
>
> ```
> ignite:
>   igniteInstanceName: properties-instance-name
>   communicationSpi:
> localPort: 
>   dataStorageConfiguration:
> defaultDataRegionConfiguration:
>   initialSize: 10485760 #10MB
> dataRegionConfigurations:
>   - name: my-dataregion
> initialSize: 104857600 #100MB
>   cacheConfiguration:
> - name: accounts
>   queryEntities:
>   - tableName: ACCOUNTS
> keyFieldName: ID
> keyType: java.lang.Long
> valueType: java.lang.Object
> fields:
>   ID: java.lang.Long
>   amount: java.lang.Double
>   updateDate: java.util.Date
> - name: my-cache2
> ```
>
>
> > 29 янв. 2020 г., в 15:09, Sergey Chernolyas 
> написал(а):
> >
> > Hi Nikolay!
> > I need to configure particulate repository by usual Spring configuration
> > without  using
> >
> https://ignite.apache.org/releases/latest/javadoc/org/apache/ignite/springdata20/repository/config/RepositoryConfig.html
> >
> > Am I investing to a bicycle?
> >
> > On Wed, 29 Jan 2020 at 14:58, Nikolay Izhikov 
> wrote:
> >
> >> Hello, Sergey.
> >>
> >> Your proposal is not clear for me
> >> Can you, please, describe the issue you are trying to solve?
> >> And the way you want to do it.
> >>
> >>
> >>> 29 янв. 2020 г., в 14:53, Sergey Chernolyas <
> sergey.chernol...@gmail.com>
> >> написал(а):
> >>>
> >>> Hi!
> >>> It is proposed to use the structure for configuration.
> >>>
> >>> spring.data.ignite:
> >>>  - name: cache1
> >>> sqlSchema: schema1
> >>> atomicityMode: TRANSACTIONAL_SNAPSHOT
> >>>  - name: cache2
> >>> sqlSchema: schema2
> >>> storeKeepBinary: true
> >>>  - name: cache3
> >>>sqlQuery: CREATE TABLE IF NOT EXISTS Person (id int, city_id int,
> >> name
> >>> varchar, age int,  company varchar, PRIMARY KEY (id, city_id))
> >>>
> >>> Other ideas ?
> >>>
> >>>
> >>>
> >>> --
> >>> -
> >>>
> >>> With best regards, Sergey Chernolyas
> >>
> >>
> >
> > --
> > -
> >
> > With best regards, Sergey Chernolyas
>
>

-- 
-

With best regards, Sergey Chernolyas


Re: [IGNITE-12582] Configuration by property

2020-01-29 Thread Nikolay Izhikov
Hello, Sergey.

What is «repository»? How it relates to the Ignite?

ignite-spring-boot-autoconfigure confirms your requirements?

https://github.com/apache/ignite-extensions/blob/master/modules/spring-boot-autoconfigure/examples/main/resources/application.yml

```
ignite:
  igniteInstanceName: properties-instance-name
  communicationSpi:
localPort: 
  dataStorageConfiguration:
defaultDataRegionConfiguration:
  initialSize: 10485760 #10MB
dataRegionConfigurations:
  - name: my-dataregion
initialSize: 104857600 #100MB
  cacheConfiguration:
- name: accounts
  queryEntities:
  - tableName: ACCOUNTS
keyFieldName: ID
keyType: java.lang.Long
valueType: java.lang.Object
fields:
  ID: java.lang.Long
  amount: java.lang.Double
  updateDate: java.util.Date
- name: my-cache2
```


> 29 янв. 2020 г., в 15:09, Sergey Chernolyas  
> написал(а):
> 
> Hi Nikolay!
> I need to configure particulate repository by usual Spring configuration
> without  using
> https://ignite.apache.org/releases/latest/javadoc/org/apache/ignite/springdata20/repository/config/RepositoryConfig.html
> 
> Am I investing to a bicycle?
> 
> On Wed, 29 Jan 2020 at 14:58, Nikolay Izhikov  wrote:
> 
>> Hello, Sergey.
>> 
>> Your proposal is not clear for me
>> Can you, please, describe the issue you are trying to solve?
>> And the way you want to do it.
>> 
>> 
>>> 29 янв. 2020 г., в 14:53, Sergey Chernolyas 
>> написал(а):
>>> 
>>> Hi!
>>> It is proposed to use the structure for configuration.
>>> 
>>> spring.data.ignite:
>>>  - name: cache1
>>> sqlSchema: schema1
>>> atomicityMode: TRANSACTIONAL_SNAPSHOT
>>>  - name: cache2
>>> sqlSchema: schema2
>>> storeKeepBinary: true
>>>  - name: cache3
>>>sqlQuery: CREATE TABLE IF NOT EXISTS Person (id int, city_id int,
>> name
>>> varchar, age int,  company varchar, PRIMARY KEY (id, city_id))
>>> 
>>> Other ideas ?
>>> 
>>> 
>>> 
>>> --
>>> -
>>> 
>>> With best regards, Sergey Chernolyas
>> 
>> 
> 
> -- 
> -
> 
> With best regards, Sergey Chernolyas



Re: [IGNITE-12582] Configuration by property

2020-01-29 Thread Sergey Chernolyas
Hi Nikolay!
I need to configure particulate repository by usual Spring configuration
without  using
https://ignite.apache.org/releases/latest/javadoc/org/apache/ignite/springdata20/repository/config/RepositoryConfig.html

Am I investing to a bicycle?

On Wed, 29 Jan 2020 at 14:58, Nikolay Izhikov  wrote:

> Hello, Sergey.
>
> Your proposal is not clear for me
> Can you, please, describe the issue you are trying to solve?
> And the way you want to do it.
>
>
> > 29 янв. 2020 г., в 14:53, Sergey Chernolyas 
> написал(а):
> >
> > Hi!
> > It is proposed to use the structure for configuration.
> >
> > spring.data.ignite:
> >   - name: cache1
> >  sqlSchema: schema1
> >  atomicityMode: TRANSACTIONAL_SNAPSHOT
> >   - name: cache2
> >  sqlSchema: schema2
> >  storeKeepBinary: true
> >   - name: cache3
> > sqlQuery: CREATE TABLE IF NOT EXISTS Person (id int, city_id int,
> name
> > varchar, age int,  company varchar, PRIMARY KEY (id, city_id))
> >
> > Other ideas ?
> >
> >
> >
> > --
> > -
> >
> > With best regards, Sergey Chernolyas
>
>

-- 
-

With best regards, Sergey Chernolyas


Re: [IGNITE-12582] Configuration by property

2020-01-29 Thread Nikolay Izhikov
Hello, Sergey.

Your proposal is not clear for me 
Can you, please, describe the issue you are trying to solve?
And the way you want to do it.


> 29 янв. 2020 г., в 14:53, Sergey Chernolyas  
> написал(а):
> 
> Hi!
> It is proposed to use the structure for configuration.
> 
> spring.data.ignite:
>   - name: cache1
>  sqlSchema: schema1
>  atomicityMode: TRANSACTIONAL_SNAPSHOT
>   - name: cache2
>  sqlSchema: schema2
>  storeKeepBinary: true
>   - name: cache3
> sqlQuery: CREATE TABLE IF NOT EXISTS Person (id int, city_id int, name
> varchar, age int,  company varchar, PRIMARY KEY (id, city_id))
> 
> Other ideas ?
> 
> 
> 
> -- 
> -
> 
> With best regards, Sergey Chernolyas



[IGNITE-12582] Configuration by property

2020-01-29 Thread Sergey Chernolyas
Hi!
It is proposed to use the structure for configuration.

spring.data.ignite:
   - name: cache1
  sqlSchema: schema1
  atomicityMode: TRANSACTIONAL_SNAPSHOT
   - name: cache2
  sqlSchema: schema2
  storeKeepBinary: true
   - name: cache3
 sqlQuery: CREATE TABLE IF NOT EXISTS Person (id int, city_id int, name
varchar, age int,  company varchar, PRIMARY KEY (id, city_id))

Other ideas ?



-- 
-

With best regards, Sergey Chernolyas