You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "Carsten Ziegeler (JIRA)" <ji...@apache.org> on 2011/08/24 11:00:32 UTC

[jira] [Created] (JCR-3060) Add utility methods for path creation

Add utility methods for path creation
-------------------------------------

                 Key: JCR-3060
                 URL: https://issues.apache.org/jira/browse/JCR-3060
             Project: Jackrabbit Content Repository
          Issue Type: Improvement
          Components: jackrabbit-jcr-commons
    Affects Versions: 2.2.7
            Reporter: Carsten Ziegeler
            Priority: Minor
         Attachments: JcrUtils.java.patch

While the JcrUtil class has methods to create a node, it does not have methods to create paths.
This patch adds several methods which allow to create or get complete node paths

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (JCR-3060) Add utility methods for path creation

Posted by "Jukka Zitting (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-3060?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jukka Zitting updated JCR-3060:
-------------------------------

    Attachment: 0002-JCR-3060-Add-utility-methods-for-path-creation.patch
                0001-JCR-3060-Add-utility-methods-for-path-creation.patch

In patch 0001 I've ported the path handling code to the getOrAddNode, getOrAddFolder and putFile methods, so they could also be given a path instead of just the name of a child node to be returned or created.

There's also a pair of new addNode() methods that support a "*" node name suffix for creating unique names using a sequence number. I think that makes for slightly simpler client code than an extra boolean argument. Note that "*" may not be used in valid JCR names, so there's no fear of collisions.

With this change the getOrAddNode methods should be able to do pretty much everything that the new getOrCreate methods do. The only exception is the autoSave flag, that I think should rather be handled by an explicit session.save() call by the client. The 0002 patch removes the duplication by making getOrCreate use getOrAddNode under the hood.

The question now is whether we want to keep the two sets of roughly equivalent method signatures.

> Add utility methods for path creation
> -------------------------------------
>
>                 Key: JCR-3060
>                 URL: https://issues.apache.org/jira/browse/JCR-3060
>             Project: Jackrabbit Content Repository
>          Issue Type: Improvement
>          Components: jackrabbit-jcr-commons
>    Affects Versions: 2.2.7
>            Reporter: Carsten Ziegeler
>            Priority: Minor
>         Attachments: 0001-JCR-3060-Add-utility-methods-for-path-creation.patch, 0002-JCR-3060-Add-utility-methods-for-path-creation.patch, JcrUtils.java.patch
>
>
> While the JcrUtil class has methods to create a node, it does not have methods to create paths.
> This patch adds several methods which allow to create or get complete node paths

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (JCR-3060) Add utility methods for path creation

Posted by "Carsten Ziegeler (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-3060?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13090209#comment-13090209 ] 

Carsten Ziegeler commented on JCR-3060:
---------------------------------------

I've attached a new patch with changed method names and also check the node types for null now

> Add utility methods for path creation
> -------------------------------------
>
>                 Key: JCR-3060
>                 URL: https://issues.apache.org/jira/browse/JCR-3060
>             Project: Jackrabbit Content Repository
>          Issue Type: Improvement
>          Components: jackrabbit-jcr-commons
>    Affects Versions: 2.2.7
>            Reporter: Carsten Ziegeler
>            Priority: Minor
>         Attachments: JcrUtils.java.patch
>
>
> While the JcrUtil class has methods to create a node, it does not have methods to create paths.
> This patch adds several methods which allow to create or get complete node paths

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (JCR-3060) Add utility methods for path creation

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

Jukka Zitting commented on JCR-3060:
------------------------------------

Updated patch committed in revision 1161106.

I'll look at how we could make these new methods work better in line with the existing getOrAddNode methods. Now there's quite a bit of duplicated logic.

PS. See also JCR-2687 for an older issue with a similar though more generic use case.

> Add utility methods for path creation
> -------------------------------------
>
>                 Key: JCR-3060
>                 URL: https://issues.apache.org/jira/browse/JCR-3060
>             Project: Jackrabbit Content Repository
>          Issue Type: Improvement
>          Components: jackrabbit-jcr-commons
>    Affects Versions: 2.2.7
>            Reporter: Carsten Ziegeler
>            Priority: Minor
>         Attachments: JcrUtils.java.patch
>
>
> While the JcrUtil class has methods to create a node, it does not have methods to create paths.
> This patch adds several methods which allow to create or get complete node paths

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (JCR-3060) Add utility methods for path creation

Posted by "Carsten Ziegeler (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-3060?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Carsten Ziegeler updated JCR-3060:
----------------------------------

    Attachment:     (was: JcrUtils.java.patch)

> Add utility methods for path creation
> -------------------------------------
>
>                 Key: JCR-3060
>                 URL: https://issues.apache.org/jira/browse/JCR-3060
>             Project: Jackrabbit Content Repository
>          Issue Type: Improvement
>          Components: jackrabbit-jcr-commons
>    Affects Versions: 2.2.7
>            Reporter: Carsten Ziegeler
>            Priority: Minor
>         Attachments: JcrUtils.java.patch
>
>
> While the JcrUtil class has methods to create a node, it does not have methods to create paths.
> This patch adds several methods which allow to create or get complete node paths

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (JCR-3060) Add utility methods for path creation

Posted by "Carsten Ziegeler (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-3060?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Carsten Ziegeler updated JCR-3060:
----------------------------------

    Attachment: JcrUtils.java.patch

> Add utility methods for path creation
> -------------------------------------
>
>                 Key: JCR-3060
>                 URL: https://issues.apache.org/jira/browse/JCR-3060
>             Project: Jackrabbit Content Repository
>          Issue Type: Improvement
>          Components: jackrabbit-jcr-commons
>    Affects Versions: 2.2.7
>            Reporter: Carsten Ziegeler
>            Priority: Minor
>         Attachments: JcrUtils.java.patch
>
>
> While the JcrUtil class has methods to create a node, it does not have methods to create paths.
> This patch adds several methods which allow to create or get complete node paths

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (JCR-3060) Add utility methods for path creation

Posted by "Carsten Ziegeler (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-3060?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13090153#comment-13090153 ] 

Carsten Ziegeler commented on JCR-3060:
---------------------------------------

Sounds good to me, do you want me to create a new patch?

> Add utility methods for path creation
> -------------------------------------
>
>                 Key: JCR-3060
>                 URL: https://issues.apache.org/jira/browse/JCR-3060
>             Project: Jackrabbit Content Repository
>          Issue Type: Improvement
>          Components: jackrabbit-jcr-commons
>    Affects Versions: 2.2.7
>            Reporter: Carsten Ziegeler
>            Priority: Minor
>         Attachments: JcrUtils.java.patch
>
>
> While the JcrUtil class has methods to create a node, it does not have methods to create paths.
> This patch adds several methods which allow to create or get complete node paths

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (JCR-3060) Add utility methods for path creation

Posted by "Stefan Guggisberg (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-3060?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13090154#comment-13090154 ] 

Stefan Guggisberg commented on JCR-3060:
----------------------------------------

no, if you'll change the names to something more appropriate that's fine with me. 

> Add utility methods for path creation
> -------------------------------------
>
>                 Key: JCR-3060
>                 URL: https://issues.apache.org/jira/browse/JCR-3060
>             Project: Jackrabbit Content Repository
>          Issue Type: Improvement
>          Components: jackrabbit-jcr-commons
>    Affects Versions: 2.2.7
>            Reporter: Carsten Ziegeler
>            Priority: Minor
>         Attachments: JcrUtils.java.patch
>
>
> While the JcrUtil class has methods to create a node, it does not have methods to create paths.
> This patch adds several methods which allow to create or get complete node paths

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (JCR-3060) Add utility methods for path creation

Posted by "Carsten Ziegeler (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-3060?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Carsten Ziegeler updated JCR-3060:
----------------------------------

    Attachment: JcrUtils.java.patch

> Add utility methods for path creation
> -------------------------------------
>
>                 Key: JCR-3060
>                 URL: https://issues.apache.org/jira/browse/JCR-3060
>             Project: Jackrabbit Content Repository
>          Issue Type: Improvement
>          Components: jackrabbit-jcr-commons
>    Affects Versions: 2.2.7
>            Reporter: Carsten Ziegeler
>            Priority: Minor
>         Attachments: JcrUtils.java.patch, JcrUtils.java.patch
>
>
> While the JcrUtil class has methods to create a node, it does not have methods to create paths.
> This patch adds several methods which allow to create or get complete node paths

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (JCR-3060) Add utility methods for path creation

Posted by "Stefan Guggisberg (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-3060?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13090114#comment-13090114 ] 

Stefan Guggisberg commented on JCR-3060:
----------------------------------------

the method names are IMO misleading (createPath suggests that a Path object is created).

how about e.g.

- getOrCreateNode
- getOrCreateByPath


> Add utility methods for path creation
> -------------------------------------
>
>                 Key: JCR-3060
>                 URL: https://issues.apache.org/jira/browse/JCR-3060
>             Project: Jackrabbit Content Repository
>          Issue Type: Improvement
>          Components: jackrabbit-jcr-commons
>    Affects Versions: 2.2.7
>            Reporter: Carsten Ziegeler
>            Priority: Minor
>         Attachments: JcrUtils.java.patch
>
>
> While the JcrUtil class has methods to create a node, it does not have methods to create paths.
> This patch adds several methods which allow to create or get complete node paths

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (JCR-3060) Add utility methods for path creation

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

Michael Dürig commented on JCR-3060:
------------------------------------

With the patch the node types have to be specified explicitly. Wouldn't it make sense to extend this such that when no node type (intermediate node type) is specified, the type is determined by the child node definitions in the node types of its parent? See  Node.addNode(String) [1] 

[1] http://www.day.com/maven/jsr170/javadocs/jcr-2.0/javax/jcr/Node.html#addNode%28java.lang.String%29

> Add utility methods for path creation
> -------------------------------------
>
>                 Key: JCR-3060
>                 URL: https://issues.apache.org/jira/browse/JCR-3060
>             Project: Jackrabbit Content Repository
>          Issue Type: Improvement
>          Components: jackrabbit-jcr-commons
>    Affects Versions: 2.2.7
>            Reporter: Carsten Ziegeler
>            Priority: Minor
>         Attachments: JcrUtils.java.patch
>
>
> While the JcrUtil class has methods to create a node, it does not have methods to create paths.
> This patch adds several methods which allow to create or get complete node paths

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira