Java Client Riak Builders...

Guido Medina lic_gma at hotmail.com
Wed May 30 11:52:12 EDT 2012


Give a quick review to git://github.com/guido-medina/riak-java-client.git

And let me know if there are more changes to add/correct, I'm switching 
from work to home so I can continue in there, the modifications are fair 
simple, I thought about adding bean utils for reflection but managed not 
to since on indexes we are talking about int, String or a Set<?> of 
either, I restricted the collection type to be a Set<?> since indexes 
with duplicated values don't make sense.

About annotating the methods with index, it is now possible but only 
when sending from POJO to Riak (and return type has to be a Set<?>), if 
you want to recover the index value(s) from Riak you have to do it as a 
Field (Which can be a Set<?> now)

Dependencies httpclient upgraded from 4.1.1 to 4.1.3 and jackson from 
1.9.2 to 1.9.4.

Regards,

Guido.

On 29/05/12 20:23, Brian Roach wrote:
> Actually, it was on purpose. As sort of a "step 1" to getting rid of it, the goal was just to get the code out of our repo and use maven to pull it in. As you note and as far as I could find, the latest development on github is not being published to maven central.
>
> Long term I want to eliminate it completely and use Jackson for everything.
>
> Thanks,
> - Roach
>
>
> On May 29, 2012, at 1:07 PM, Guido Medina wrote:
>
>> Also, the coming riak client version removed the embedded json package from it and put an old implementation from the main maven repo, I think that what was meant to do was to put this version: https://github.com/douglascrockford/JSON-java which has lot of performance improvements but no maven repo, the old:
>>
>>        <dependency>
>>            <groupId>org.json</groupId>
>>            <artifactId>json</artifactId>
>>            <version>20090211</version>
>>        </dependency>
>>
>> uses lot of StringBuffer instead of StringBuilders and StringWritters introduced later on.
>>
>> I'm wondering about the benchmark of one vs the other.
>>
>> Regards,
>>
>> Guido.
>>
>> -----Original Message----- From: Brian Roach
>> Sent: Tuesday, May 29, 2012 7:05 PM
>> To: Guido Medina
>> Cc: riak-users at lists.basho.com
>> Subject: Re: Java Client Riak Builders...
>>
>> Guido -
>>
>> Thanks, looking forward to it.
>>
>> Also as an FYI, on Friday I fixed the bug that was causing the requirement of the @JsonIgnore for Riak annotated fields without getters.
>>
>> - Brian Roach
>>
>> On May 29, 2012, at 11:52 AM, Guido Medina wrote:
>>
>>> I will request a "pull request", I fixed it, I enabled @RiakIndex for collection fields AND methods (String, Integer or Collection of any of those), on our coding is working, but still I need to test it more before making it final.
>>>
>>> I will share the details tomorrow, I already created a fork from your master branch.
>>>
>>> Now you can have something like:
>>>
>>> @RiakIndex
>>> @JsonIgnore
>>> Collection<Integer>  getNumbers()
>>>
>>> Also this works as index and with no getter (as of 1.0.6-SNAPSHOT) will only be that, an index:
>>>
>>> @RiakIndex
>>> Collection<String>  numbers;
>>> That will act as index and be ignored as property which is the intention of the index, to be a dynamic calculated value(s) and not as property which requires the caller to call a post-construct.
>>>
>>> And of course, all subclasses of a collection apply.
>>>
>>> Thanks for the answer,
>>>
>>> Guido.
>>>
>>> -----Original Message----- From: Brian Roach
>>> Sent: Tuesday, May 29, 2012 6:09 PM
>>> To: Guido Medina
>>> Cc: riak-users at lists.basho.com
>>> Subject: Re: Java Client Riak Builders...
>>>
>>> Guido -
>>>
>>> The real fix is to enhance the client to support a Collection, I'll add an issue for this in github.
>>>
>>> What you would need to do right now is write your own Converter (which would really just be a modification of our JSONConverter if you're using JSON) that does this for you.
>>>
>>> If you look at the source for JSONConverter you'll see where the indexes are processed.  As it is, the index processing is handled by the RiakIndexConverter<T>  class which is where the limitation of requiring the annotated field to be a String is coming from (it's actually buried lower than that in the underlying annotation processing, but that's the starting point for the problem). The actual RiakIndexes class that encapsulates the data and exists in the IRiakObject doesn't have this problem.
>>>
>>> The catch is that you'll need to do all the reflection ugliness yourself, as that's the part that's broken (the annotation processing).
>>>
>>> Basically, in JSONConverter.fromDomain() you would need to replace
>>> RiakIndexes indexes = riakIndexConverter.getIndexes(domainObject);
>>> with your own annotation processing. The same would need to be done in JSONConverter.toDomain() at
>>> riakIndexConverter.populateIndexes(…)
>>>
>>> Obviously this is not ideal and I'm considering it a bug; I'll put this toward to top of the list of things I'm working on right now.
>>>
>>> Thanks,
>>> Brian Roach
>>>
>>>
>>>
>>>
>>> On May 28, 2012, at 8:03 AM, Guido Medina wrote:
>>>
>>>> Hi,
>>>>
>>>> I'm looking for a work around @RiakIndex annotation to support multiple values per index name, since the annotation is limited to one single value per annotated property (no collection support), I would like to know if there is a way of using the DomainBucketBuilder, mutation&  conflict resolver and at the same time has access to a method signature like addIndex(String or int)...addIndex(String or int)...build() same as you can do with RiakObjectBuilder which lacks support for conflict resolution and mutation style.
>>>>
>>>> Regards,
>>>>
>>>> Guido.
>>>>
>>>> _______________________________________________
>>>> riak-users mailing list
>>>> riak-users at lists.basho.com
>>>> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>>>
>>> _______________________________________________
>>> riak-users mailing list
>>> riak-users at lists.basho.com
>>> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>>
>> _______________________________________________
>> riak-users mailing list
>> riak-users at lists.basho.com
>> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>
>




More information about the riak-users mailing list