You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-issues@jackrabbit.apache.org by "angela (JIRA)" <ji...@apache.org> on 2012/10/17 14:00:03 UTC

[jira] [Created] (OAK-380) Define conversion of property values

angela created OAK-380:
--------------------------

             Summary: Define conversion of property values
                 Key: OAK-380
                 URL: https://issues.apache.org/jira/browse/OAK-380
             Project: Jackrabbit Oak
          Issue Type: Bug
          Components: core
            Reporter: angela


i just run into the situation of converting a propertystate's value
of type Date to a Long, which currently throws numberformatexception.

while i can work around this, i think we should come up with a clear
definition on value conversion provided by oak-api. the only thing i
found so far was the description in PropertyState#getValue that claims
that a conversion in done but not which conversions are supported.
unless otherwise specified i had silently expected that simple jcr-conversions
would work.



--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (OAK-380) Define conversion of property values

Posted by "Michael Dürig (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OAK-380?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13480525#comment-13480525 ] 

Michael Dürig commented on OAK-380:
-----------------------------------

Turns out that the only missing part was conversions for dates. I added these in revision 1400338. 
In revision 1400339 I refactored ValueImpl et. all. to make use of the new conversion utilities as much as possible. Anything left?
                
> Define conversion of property values
> ------------------------------------
>
>                 Key: OAK-380
>                 URL: https://issues.apache.org/jira/browse/OAK-380
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: core
>            Reporter: angela
>
> i just run into the situation of converting a propertystate's value
> of type Date to a Long, which currently throws numberformatexception.
> while i can work around this, i think we should come up with a clear
> definition on value conversion provided by oak-api. the only thing i
> found so far was the description in PropertyState#getValue that claims
> that a conversion in done but not which conversions are supported.
> unless otherwise specified i had silently expected that simple jcr-conversions
> would work.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (OAK-380) Define conversion of property values

Posted by "Marcel Reutegger (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OAK-380?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13487661#comment-13487661 ] 

Marcel Reutegger commented on OAK-380:
--------------------------------------

bq. Anything left?

performance... toCalendar() is quite slow on my system. 1 million calls take ~80 seconds on my system because of the TimeZone lookup. In revision 1404080 I changed that into a static field, which speeds up the 1 millions calls considerably. Now it takes 700 ms on my system.
                
> Define conversion of property values
> ------------------------------------
>
>                 Key: OAK-380
>                 URL: https://issues.apache.org/jira/browse/OAK-380
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: core
>            Reporter: angela
>
> i just run into the situation of converting a propertystate's value
> of type Date to a Long, which currently throws numberformatexception.
> while i can work around this, i think we should come up with a clear
> definition on value conversion provided by oak-api. the only thing i
> found so far was the description in PropertyState#getValue that claims
> that a conversion in done but not which conversions are supported.
> unless otherwise specified i had silently expected that simple jcr-conversions
> would work.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (OAK-380) Define conversion of property values

Posted by "Michael Dürig (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OAK-380?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13479995#comment-13479995 ] 

Michael Dürig commented on OAK-380:
-----------------------------------

bq. To start with I'm not too excited about having JCR value types present in oak-core...

Agreed, however it turned out that in the other case conversions tend to scatter all over the code. I think there is no much harm done here since if you ignore the definitions for date, name, path, reference, weakreference and uri in {{Type}}, you are back to just the JSON types.

bq. +1 for direct conversion in the API

Ok, the implementation will still delegate to the utility class. Since these conversions will be needed from other places which don't deal with property states directly too.

                
> Define conversion of property values
> ------------------------------------
>
>                 Key: OAK-380
>                 URL: https://issues.apache.org/jira/browse/OAK-380
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: core
>            Reporter: angela
>
> i just run into the situation of converting a propertystate's value
> of type Date to a Long, which currently throws numberformatexception.
> while i can work around this, i think we should come up with a clear
> definition on value conversion provided by oak-api. the only thing i
> found so far was the description in PropertyState#getValue that claims
> that a conversion in done but not which conversions are supported.
> unless otherwise specified i had silently expected that simple jcr-conversions
> would work.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (OAK-380) Define conversion of property values

Posted by "Jukka Zitting (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OAK-380?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13479973#comment-13479973 ] 

Jukka Zitting commented on OAK-380:
-----------------------------------

To start with I'm not too excited about having JCR value types present in oak-core. I'd rather just deal with JSON types (with default JavaScript type conversions) at this level and leave more complex typing to oak-jcr and the various JCR-related plugins we have.

Anyway, since we now do have JCR values types in oak-core, I think it would make sense to also support JCR value conversions directly through the API instead of a separate utility class. However, I'd still exclude all name mappings from oak-core.
                
> Define conversion of property values
> ------------------------------------
>
>                 Key: OAK-380
>                 URL: https://issues.apache.org/jira/browse/OAK-380
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: core
>            Reporter: angela
>
> i just run into the situation of converting a propertystate's value
> of type Date to a Long, which currently throws numberformatexception.
> while i can work around this, i think we should come up with a clear
> definition on value conversion provided by oak-api. the only thing i
> found so far was the description in PropertyState#getValue that claims
> that a conversion in done but not which conversions are supported.
> unless otherwise specified i had silently expected that simple jcr-conversions
> would work.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (OAK-380) Define conversion of property values

Posted by "Michael Dürig (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OAK-380?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13477811#comment-13477811 ] 

Michael Dürig commented on OAK-380:
-----------------------------------

The conversions currently in place are the same we had earlier on {{CoreValue}} (i.e. before OAK-350). I'm not sure what the original motivation was for the kind of conversions which are built in but I think we should either

# Provide no conversion at all at that level but have a dedicated utility for handling conversions or, 
# provide all conversion mandated by JCR. 

In the latter case I'd still delegate that conversion functionality to a utility method which then could also be used otherwise. 
                
> Define conversion of property values
> ------------------------------------
>
>                 Key: OAK-380
>                 URL: https://issues.apache.org/jira/browse/OAK-380
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: core
>            Reporter: angela
>
> i just run into the situation of converting a propertystate's value
> of type Date to a Long, which currently throws numberformatexception.
> while i can work around this, i think we should come up with a clear
> definition on value conversion provided by oak-api. the only thing i
> found so far was the description in PropertyState#getValue that claims
> that a conversion in done but not which conversions are supported.
> unless otherwise specified i had silently expected that simple jcr-conversions
> would work.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (OAK-380) Define conversion of property values

Posted by "Michael Dürig (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OAK-380?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13479965#comment-13479965 ] 

Michael Dürig commented on OAK-380:
-----------------------------------

After a 2nd though, it might make sense to extend these conversions to all JCR types. That way we'd have a single place where the conversions are defined and which could be used from other code as well. Note, that even then conversions involving name/path mappings would still have to be made explicitly. When done through the {{PropertyState.getValue()}} methods such conversions would either fail or use a default name/path mapping (preferences?). 

Thoughts?
                
> Define conversion of property values
> ------------------------------------
>
>                 Key: OAK-380
>                 URL: https://issues.apache.org/jira/browse/OAK-380
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: core
>            Reporter: angela
>
> i just run into the situation of converting a propertystate's value
> of type Date to a Long, which currently throws numberformatexception.
> while i can work around this, i think we should come up with a clear
> definition on value conversion provided by oak-api. the only thing i
> found so far was the description in PropertyState#getValue that claims
> that a conversion in done but not which conversions are supported.
> unless otherwise specified i had silently expected that simple jcr-conversions
> would work.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (OAK-380) Define conversion of property values

Posted by "angela (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OAK-380?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13479986#comment-13479986 ] 

angela commented on OAK-380:
----------------------------

+1 for extending the conversion to all jcr-types
+1 for direct conversion in the API

regarding proper jcr compliant conversion of name/paths: as far as i remember there very
few valid conversions (something like uri/string/name/path are convertable).
i think i would leave the namespace / expanded name and path handling to jcr only
but support anything that was straight forward.


                
> Define conversion of property values
> ------------------------------------
>
>                 Key: OAK-380
>                 URL: https://issues.apache.org/jira/browse/OAK-380
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: core
>            Reporter: angela
>
> i just run into the situation of converting a propertystate's value
> of type Date to a Long, which currently throws numberformatexception.
> while i can work around this, i think we should come up with a clear
> definition on value conversion provided by oak-api. the only thing i
> found so far was the description in PropertyState#getValue that claims
> that a conversion in done but not which conversions are supported.
> unless otherwise specified i had silently expected that simple jcr-conversions
> would work.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (OAK-380) Define conversion of property values

Posted by "angela (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OAK-380?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13477852#comment-13477852 ] 

angela commented on OAK-380:
----------------------------

i don't have any particular preference... i just think it's odd if the conversion is
done halfway and everyone needs to write the same code.

in any case i feel that the oak-api needs to be totally clear about this and explain
which conversions are made and which conversions fail and how the legitimate
jcr conversions can be achieved... something along that line...
                
> Define conversion of property values
> ------------------------------------
>
>                 Key: OAK-380
>                 URL: https://issues.apache.org/jira/browse/OAK-380
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: core
>            Reporter: angela
>
> i just run into the situation of converting a propertystate's value
> of type Date to a Long, which currently throws numberformatexception.
> while i can work around this, i think we should come up with a clear
> definition on value conversion provided by oak-api. the only thing i
> found so far was the description in PropertyState#getValue that claims
> that a conversion in done but not which conversions are supported.
> unless otherwise specified i had silently expected that simple jcr-conversions
> would work.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (OAK-380) Define conversion of property values

Posted by "Michael Dürig (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OAK-380?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13479029#comment-13479029 ] 

Michael Dürig commented on OAK-380:
-----------------------------------

I made the current conversions explicit with revision 1399669. All conversions from the various {{PropertyState}} implementations no go through the new {{Conversions}} class which can also be used standalone.

The ideas is that at this level only the conversions between the various representations of values as Java types are handled. That is, conversions between {{String}}, {{Blob}}, {{long}}, {{double}}, {{boolean}} and {{BigDecimal}}. 
Conversions of values encoded into these types (e.g. PATH) should be handled separately. Currently this is done within {{ValueImpl}} and {{ValueFactoryImpl}}. However, since we might need such conversions also outside of the scope of JCR values, the next step here should be to untangle conversion of JCR values and {{ValueImpl}}/{{ValueFactoryImpl}}.
                
> Define conversion of property values
> ------------------------------------
>
>                 Key: OAK-380
>                 URL: https://issues.apache.org/jira/browse/OAK-380
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: core
>            Reporter: angela
>
> i just run into the situation of converting a propertystate's value
> of type Date to a Long, which currently throws numberformatexception.
> while i can work around this, i think we should come up with a clear
> definition on value conversion provided by oak-api. the only thing i
> found so far was the description in PropertyState#getValue that claims
> that a conversion in done but not which conversions are supported.
> unless otherwise specified i had silently expected that simple jcr-conversions
> would work.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira