[jsr-314-open-mirror] [jsr-314-open] [2.1 Spec Review] Transient State [Was: Fix UIData state saving model]
Martin Marinschek
mmarinschek at apache.org
Wed Oct 20 13:18:14 EDT 2010
Hi Andy,
I agree with the points:
- get/putTransient should be on UIComponent, or TransientStateHelper
needs to be exposed
- no Serializable keys are necessary
But - I am not sure about removing the TransientStateHelper
contract... It doesn't need to extend from StateHelper, that is true -
but won't the code look funny if state-saved property handling looks
different from transient property handling?
best regards,
Martin
On 10/19/10, Andy Schwartz <andy.schwartz at oracle.com> wrote:
> Another thought... The TransientStateHelper extends StateHelper. Is this
> necessary? I would prefer to be able to provide an implementation of
> TransientStateHelper (eg. in Trinidad's UIXComponentBase) without also
> having to implement the very extensive StateHelper contract. Can we
> separate these two?
>
> BTW, if we consider adding back the public get/putTransient() methods on
> UIComponent as Leonardo proposed originally, I kind of wonder whether we
> actually need a public TransientStateHelper contract at all. The details of
> transient state storage could be handled internally.
>
> Andy
>
> On 10/19/10 3:19 PM, Andy Schwartz wrote:
>>
>> Gang -
>>
>> According to the discussion in this thread, it sounds as if we were
>> looking for a way to be able to set arbitrary transient (non-state-saved)
>> properties on UIComponent instances. In particular, Leonardo stated that:
>>
>>> these methods will be used by the vdl or renderers
>>
>>
>> Martin also mentioned:
>>
>>> adding some methods (getter/setter) on UIComponent, to make possible
>>> manipulate them from "outside"the component instance
>>
>>
>> Leonardo's original proposal - adding public get/putTransient() method on
>> UIComponent - accomplishes this goal.
>>
>> However, while reviewing the 20101013 API doc for UIComponent, I see that
>> access to these transient properties from "outside" of the component
>> instance is no longer possible. There are no public get/putTransient()
>> methods on UIComponent. getTransientStateHelper() is protected. This
>> means that arbitrary external access to transient properties is not
>> supported. Is this by design?
>>
>> Also, looking at TransientStateHelper, I see that the property keys are
>> declared as Serializable. However, isn't the point that these transient
>> properties are per-request and will not be state saved? Who is
>> serializing this data? Unless I am missing some reason why this transient
>> data is being serialized, we should change the type of the property key to
>> Object.
>>
>> Andy
>>
>> On 9/20/10 9:12 PM, Leonardo Uribe wrote:
>>>
>>> Hi Martin
>>>
>>> I have been thinking a lot about it and for this one just add two simple
>>> methods on UIComponent could do the job:
>>>
>>> public Object getTransient(Serializable key)
>>> {
>>> TransientStateHelper helper = getTransientStateHelper(false);
>>> if (helper != null)
>>> {
>>> return helper.get(key);
>>> }
>>> return null;
>>> }
>>>
>>> public Object putTransient(Serializable key, Object value)
>>> {
>>> return getTransientStateHelper().put(key, value);
>>> }
>>>
>>>
>>> Just like TransientStateHelper.
>>>
>>> In theory, these methods will be used by the vdl or renderers, so this
>>> two simple methods will handle these cases correctly.
>>>
>>> >From my point of view, these methods in some way looks similar to the
>>> ones used for handle ValueBinding / ValueExpression on UIComponent.
>>>
>>> best regards,
>>>
>>> Leonardo Uribe
>>>
>>> 2010/9/16 Martin Marinschek <mmarinschek at apache.org>
>>>>
>>>> Hi Leo,
>>>>
>>>> > I was thinking if the interface provided for handle transient
>>>> > properties
>>>> > should be exposed in some
>>>> > way, adding some methods (getter/setter) on UIComponent, to make
>>>> > possible
>>>> > manipulate them from "outside"
>>>> > the component instance. It will be very useful, specially for
>>>> > UIViewRoot.
>>>>
>>>> +1!
>>>>
>>>> what would be your proposed API?
>>>>
>>>> best regards,
>>>>
>>>> Martin
>>>>
>>>>
>>>> --
>>>>
>>>> http://www.irian.at
>>>>
>>>> Your JSF powerhouse -
>>>> JSF Consulting, Development and
>>>> Courses in English and German
>>>>
>>>> Professional Support for Apache MyFaces
>>>
>>>
>>
>
>
--
http://www.irian.at
Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German
Professional Support for Apache MyFaces
More information about the jsr-314-open-mirror
mailing list