You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geode.apache.org by "gtantachuco ." <gt...@gmail.com> on 2015/07/08 20:08:12 UTC
[Feature request] OperationContext and PdxInstance
All,
I am using a plain-old Java object and Geode PDX to PUT and GET values from
a client app to a Geode region. Thanks to PDX, I don't have to install the
class on the Geode cluster.
In my implementation of the AccessControl interface, I receive the
OperationContext object as part of the pre- and post-authorization
callbacks. I was expecting to receive a PdxInstance object but instead I am
receiving a byte[] object.
In the future, It would be nice to receive a PdxInstance to make the
process much cleaner. For now I have to do this something like this to get
my PdxInstance object:
PdxInputStream pdxIs = new PdxInputStream((byte[])
((KeyValueOperationContext) context).getValue());
userData = (PdxInstance) DataSerializer.readObject(pdxIs);
--
Best regards,
-Guillermo
Re: [Feature request] OperationContext and PdxInstance
Posted by "gtantachuco ." <gt...@gmail.com>.
Thanks Darrel.
On Wed, Jul 8, 2015 at 4:37 PM, Darrel Schneider <ds...@pivotal.io>
wrote:
> See: https://issues.apache.org/jira/browse/GEODE-86
>
> On Wed, Jul 8, 2015 at 2:33 PM, Darrel Schneider <ds...@pivotal.io>
> wrote:
>
>> This looks like a bug
>> in com.gemstone.gemfire.cache.operations.KeyValueOperationContext.getValue().
>> This method should return to deserialized value for the operation. The
>> javadocs don't actually say this but I think that was the idea. If you
>> wanted to serialized value you could call getSerializedValue().
>>
>> The problem with the current getValue implementation is that if the
>> context has a serialized value it just returns it. But the serialized value
>> will always be a byte[] that contains the serialized bytes.
>>
>> getValue should only return a byte array if the actual value passed to
>> the operation was a byte array.
>> I will fire a jira ticket for this. Thanks for reporting it.
>>
>> Your workaround looks reasonable.
>>
>>
>> On Wed, Jul 8, 2015 at 11:08 AM, gtantachuco . <gt...@gmail.com>
>> wrote:
>>
>>> All,
>>> I am using a plain-old Java object and Geode PDX to PUT and GET values
>>> from a client app to a Geode region. Thanks to PDX, I don't have to install
>>> the class on the Geode cluster.
>>>
>>> In my implementation of the AccessControl interface, I receive the
>>> OperationContext object as part of the pre- and post-authorization
>>> callbacks. I was expecting to receive a PdxInstance object but instead I am
>>> receiving a byte[] object.
>>> In the future, It would be nice to receive a PdxInstance to make the
>>> process much cleaner. For now I have to do this something like this to get
>>> my PdxInstance object:
>>>
>>> PdxInputStream pdxIs = new PdxInputStream((byte[])
>>> ((KeyValueOperationContext) context).getValue());
>>>
>>> userData = (PdxInstance) DataSerializer.readObject(pdxIs);
>>>
>>> --
>>> Best regards,
>>> -Guillermo
>>>
>>>
>>
>
--
Best regards,
-Guillermo
Re: [Feature request] OperationContext and PdxInstance
Posted by Darrel Schneider <ds...@pivotal.io>.
See: https://issues.apache.org/jira/browse/GEODE-86
On Wed, Jul 8, 2015 at 2:33 PM, Darrel Schneider <ds...@pivotal.io>
wrote:
> This looks like a bug
> in com.gemstone.gemfire.cache.operations.KeyValueOperationContext.getValue().
> This method should return to deserialized value for the operation. The
> javadocs don't actually say this but I think that was the idea. If you
> wanted to serialized value you could call getSerializedValue().
>
> The problem with the current getValue implementation is that if the
> context has a serialized value it just returns it. But the serialized value
> will always be a byte[] that contains the serialized bytes.
>
> getValue should only return a byte array if the actual value passed to the
> operation was a byte array.
> I will fire a jira ticket for this. Thanks for reporting it.
>
> Your workaround looks reasonable.
>
>
> On Wed, Jul 8, 2015 at 11:08 AM, gtantachuco . <gt...@gmail.com>
> wrote:
>
>> All,
>> I am using a plain-old Java object and Geode PDX to PUT and GET values
>> from a client app to a Geode region. Thanks to PDX, I don't have to install
>> the class on the Geode cluster.
>>
>> In my implementation of the AccessControl interface, I receive the
>> OperationContext object as part of the pre- and post-authorization
>> callbacks. I was expecting to receive a PdxInstance object but instead I am
>> receiving a byte[] object.
>> In the future, It would be nice to receive a PdxInstance to make the
>> process much cleaner. For now I have to do this something like this to get
>> my PdxInstance object:
>>
>> PdxInputStream pdxIs = new PdxInputStream((byte[])
>> ((KeyValueOperationContext) context).getValue());
>>
>> userData = (PdxInstance) DataSerializer.readObject(pdxIs);
>>
>> --
>> Best regards,
>> -Guillermo
>>
>>
>
Re: [Feature request] OperationContext and PdxInstance
Posted by Darrel Schneider <ds...@pivotal.io>.
This looks like a bug
in com.gemstone.gemfire.cache.operations.KeyValueOperationContext.getValue().
This method should return to deserialized value for the operation. The
javadocs don't actually say this but I think that was the idea. If you
wanted to serialized value you could call getSerializedValue().
The problem with the current getValue implementation is that if the context
has a serialized value it just returns it. But the serialized value will
always be a byte[] that contains the serialized bytes.
getValue should only return a byte array if the actual value passed to the
operation was a byte array.
I will fire a jira ticket for this. Thanks for reporting it.
Your workaround looks reasonable.
On Wed, Jul 8, 2015 at 11:08 AM, gtantachuco . <gt...@gmail.com>
wrote:
> All,
> I am using a plain-old Java object and Geode PDX to PUT and GET values
> from a client app to a Geode region. Thanks to PDX, I don't have to install
> the class on the Geode cluster.
>
> In my implementation of the AccessControl interface, I receive the
> OperationContext object as part of the pre- and post-authorization
> callbacks. I was expecting to receive a PdxInstance object but instead I am
> receiving a byte[] object.
> In the future, It would be nice to receive a PdxInstance to make the
> process much cleaner. For now I have to do this something like this to get
> my PdxInstance object:
>
> PdxInputStream pdxIs = new PdxInputStream((byte[])
> ((KeyValueOperationContext) context).getValue());
>
> userData = (PdxInstance) DataSerializer.readObject(pdxIs);
>
> --
> Best regards,
> -Guillermo
>
>