You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Bryce Ewing (JIRA)" <ji...@apache.org> on 2008/06/21 01:13:45 UTC

[jira] Created: (SLING-552) Improved Freemarker scripting support through adding wrappers for JCR Nodes and Properties

Improved Freemarker scripting support through adding wrappers for JCR Nodes and Properties
------------------------------------------------------------------------------------------

                 Key: SLING-552
                 URL: https://issues.apache.org/jira/browse/SLING-552
             Project: Sling
          Issue Type: Improvement
          Components: Scripting
            Reporter: Bryce Ewing
            Priority: Minor
         Attachments: freemarkerwrappers.patch

Add freemarker wrapper classes for JCR Node's and Property's, I will be adding further support as I require it but thought I would put in an initial version of this.

These wrappers provides freemarker support similar to what freemarker does with XML nodes, e.g.:
  * properties of a node can be accessed as @property_name, e.g. ${currentNode.@title} will output the title property of the current node
  * child nodes can be accessed directly via "." e.g. ${currentNode.section.@title} will output the title property of the child node of the current node named "section"
  * child nodes can be iterated over, e.g. <#list currentNode as child>${child.@title}</#list> will iterate over the child nodes of current node outputting the title property
  * multi value property nodes can be iterated over, <#list currentNode.@multiValue as value>....</#list>

I haven't tested this yet but processing nodes through macro's, as described for xml here: http://freemarker.sourceforge.net/docs/xgui_declarative_basics.html should also work.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SLING-552) Improved Freemarker scripting support through adding wrappers for JCR Nodes and Properties

Posted by "Bertrand Delacretaz (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-552?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12606983#action_12606983 ] 

Bertrand Delacretaz commented on SLING-552:
-------------------------------------------

Thanks for this, looks interesting!

I'm going to ask my usual question though: could we have tests with this? 

The scripting/javascript modules has good examples of how to write such tests, see for example the ScriptableNodeTest class [1]. 

[1] http://svn.apache.org/repos/asf/incubator/sling/trunk/scripting/javascript/src/test/java/org/apache/sling/scripting/wrapper/ScriptableNodeTest.java

> Improved Freemarker scripting support through adding wrappers for JCR Nodes and Properties
> ------------------------------------------------------------------------------------------
>
>                 Key: SLING-552
>                 URL: https://issues.apache.org/jira/browse/SLING-552
>             Project: Sling
>          Issue Type: Improvement
>          Components: Scripting
>            Reporter: Bryce Ewing
>            Priority: Minor
>         Attachments: freemarkerwrapper.patch, freemarkerwrappers.patch
>
>
> Add freemarker wrapper classes for JCR Node's and Property's, I will be adding further support as I require it but thought I would put in an initial version of this.
> These wrappers provides freemarker support similar to what freemarker does with XML nodes, e.g.:
>   * properties of a node can be accessed as @property_name, e.g. ${currentNode.@title} will output the title property of the current node
>   * child nodes can be accessed directly via "." e.g. ${currentNode.section.@title} will output the title property of the child node of the current node named "section"
>   * child nodes can be iterated over, e.g. <#list currentNode as child>${child.@title}</#list> will iterate over the child nodes of current node outputting the title property
>   * multi value property nodes can be iterated over, <#list currentNode.@multiValue as value>....</#list>
> I haven't tested this yet but processing nodes through macro's, as described for xml here: http://freemarker.sourceforge.net/docs/xgui_declarative_basics.html should also work.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (SLING-552) Improved Freemarker scripting support through adding wrappers for JCR Nodes and Properties

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

Bryce Ewing updated SLING-552:
------------------------------

    Attachment: freemarkerwrapper.patch

Patch including tests.

> Improved Freemarker scripting support through adding wrappers for JCR Nodes and Properties
> ------------------------------------------------------------------------------------------
>
>                 Key: SLING-552
>                 URL: https://issues.apache.org/jira/browse/SLING-552
>             Project: Sling
>          Issue Type: Improvement
>          Components: Scripting
>            Reporter: Bryce Ewing
>            Priority: Minor
>         Attachments: freemarkerwrapper.patch
>
>
> Add freemarker wrapper classes for JCR Node's and Property's, I will be adding further support as I require it but thought I would put in an initial version of this.
> These wrappers provides freemarker support similar to what freemarker does with XML nodes, e.g.:
>   * properties of a node can be accessed as @property_name, e.g. ${currentNode.@title} will output the title property of the current node
>   * child nodes can be accessed directly via "." e.g. ${currentNode.section.@title} will output the title property of the child node of the current node named "section"
>   * child nodes can be iterated over, e.g. <#list currentNode as child>${child.@title}</#list> will iterate over the child nodes of current node outputting the title property
>   * multi value property nodes can be iterated over, <#list currentNode.@multiValue as value>....</#list>
> I haven't tested this yet but processing nodes through macro's, as described for xml here: http://freemarker.sourceforge.net/docs/xgui_declarative_basics.html should also work.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (SLING-552) Improved Freemarker scripting support through adding wrappers for JCR Nodes and Properties

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

Bryce Ewing closed SLING-552.
-----------------------------


Tests all run fine, had issues with doing a full clean build today though and now having issues loading my content, so unable to check with the website I am developing.

> Improved Freemarker scripting support through adding wrappers for JCR Nodes and Properties
> ------------------------------------------------------------------------------------------
>
>                 Key: SLING-552
>                 URL: https://issues.apache.org/jira/browse/SLING-552
>             Project: Sling
>          Issue Type: Improvement
>          Components: Scripting
>            Reporter: Bryce Ewing
>            Assignee: Bertrand Delacretaz
>            Priority: Minor
>         Attachments: freemarkerwrapper.patch, pom.xml
>
>
> Add freemarker wrapper classes for JCR Node's and Property's, I will be adding further support as I require it but thought I would put in an initial version of this.
> These wrappers provides freemarker support similar to what freemarker does with XML nodes, e.g.:
>   * properties of a node can be accessed as @property_name, e.g. ${currentNode.@title} will output the title property of the current node
>   * child nodes can be accessed directly via "." e.g. ${currentNode.section.@title} will output the title property of the child node of the current node named "section"
>   * child nodes can be iterated over, e.g. <#list currentNode as child>${child.@title}</#list> will iterate over the child nodes of current node outputting the title property
>   * multi value property nodes can be iterated over, <#list currentNode.@multiValue as value>....</#list>
> I haven't tested this yet but processing nodes through macro's, as described for xml here: http://freemarker.sourceforge.net/docs/xgui_declarative_basics.html should also work.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (SLING-552) Improved Freemarker scripting support through adding wrappers for JCR Nodes and Properties

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

Bryce Ewing updated SLING-552:
------------------------------

    Attachment:     (was: freemarkerwrappers.patch)

> Improved Freemarker scripting support through adding wrappers for JCR Nodes and Properties
> ------------------------------------------------------------------------------------------
>
>                 Key: SLING-552
>                 URL: https://issues.apache.org/jira/browse/SLING-552
>             Project: Sling
>          Issue Type: Improvement
>          Components: Scripting
>            Reporter: Bryce Ewing
>            Priority: Minor
>         Attachments: freemarkerwrapper.patch
>
>
> Add freemarker wrapper classes for JCR Node's and Property's, I will be adding further support as I require it but thought I would put in an initial version of this.
> These wrappers provides freemarker support similar to what freemarker does with XML nodes, e.g.:
>   * properties of a node can be accessed as @property_name, e.g. ${currentNode.@title} will output the title property of the current node
>   * child nodes can be accessed directly via "." e.g. ${currentNode.section.@title} will output the title property of the child node of the current node named "section"
>   * child nodes can be iterated over, e.g. <#list currentNode as child>${child.@title}</#list> will iterate over the child nodes of current node outputting the title property
>   * multi value property nodes can be iterated over, <#list currentNode.@multiValue as value>....</#list>
> I haven't tested this yet but processing nodes through macro's, as described for xml here: http://freemarker.sourceforge.net/docs/xgui_declarative_basics.html should also work.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (SLING-552) Improved Freemarker scripting support through adding wrappers for JCR Nodes and Properties

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

Bertrand Delacretaz resolved SLING-552.
---------------------------------------

    Resolution: Fixed

Code and especially tests reviewed, patch applied in revision 670480, many thanks for your contribution!

Please cross-check and close this issue if ok.

> Improved Freemarker scripting support through adding wrappers for JCR Nodes and Properties
> ------------------------------------------------------------------------------------------
>
>                 Key: SLING-552
>                 URL: https://issues.apache.org/jira/browse/SLING-552
>             Project: Sling
>          Issue Type: Improvement
>          Components: Scripting
>            Reporter: Bryce Ewing
>            Assignee: Bertrand Delacretaz
>            Priority: Minor
>         Attachments: freemarkerwrapper.patch, pom.xml
>
>
> Add freemarker wrapper classes for JCR Node's and Property's, I will be adding further support as I require it but thought I would put in an initial version of this.
> These wrappers provides freemarker support similar to what freemarker does with XML nodes, e.g.:
>   * properties of a node can be accessed as @property_name, e.g. ${currentNode.@title} will output the title property of the current node
>   * child nodes can be accessed directly via "." e.g. ${currentNode.section.@title} will output the title property of the child node of the current node named "section"
>   * child nodes can be iterated over, e.g. <#list currentNode as child>${child.@title}</#list> will iterate over the child nodes of current node outputting the title property
>   * multi value property nodes can be iterated over, <#list currentNode.@multiValue as value>....</#list>
> I haven't tested this yet but processing nodes through macro's, as described for xml here: http://freemarker.sourceforge.net/docs/xgui_declarative_basics.html should also work.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SLING-552) Improved Freemarker scripting support through adding wrappers for JCR Nodes and Properties

Posted by "Bryce Ewing (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-552?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12607053#action_12607053 ] 

Bryce Ewing commented on SLING-552:
-----------------------------------

Yes, this was something I was going to get onto.  Have started writing the tests now.  Will attach patch when done.

> Improved Freemarker scripting support through adding wrappers for JCR Nodes and Properties
> ------------------------------------------------------------------------------------------
>
>                 Key: SLING-552
>                 URL: https://issues.apache.org/jira/browse/SLING-552
>             Project: Sling
>          Issue Type: Improvement
>          Components: Scripting
>            Reporter: Bryce Ewing
>            Priority: Minor
>         Attachments: freemarkerwrappers.patch
>
>
> Add freemarker wrapper classes for JCR Node's and Property's, I will be adding further support as I require it but thought I would put in an initial version of this.
> These wrappers provides freemarker support similar to what freemarker does with XML nodes, e.g.:
>   * properties of a node can be accessed as @property_name, e.g. ${currentNode.@title} will output the title property of the current node
>   * child nodes can be accessed directly via "." e.g. ${currentNode.section.@title} will output the title property of the child node of the current node named "section"
>   * child nodes can be iterated over, e.g. <#list currentNode as child>${child.@title}</#list> will iterate over the child nodes of current node outputting the title property
>   * multi value property nodes can be iterated over, <#list currentNode.@multiValue as value>....</#list>
> I haven't tested this yet but processing nodes through macro's, as described for xml here: http://freemarker.sourceforge.net/docs/xgui_declarative_basics.html should also work.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (SLING-552) Improved Freemarker scripting support through adding wrappers for JCR Nodes and Properties

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

Bryce Ewing updated SLING-552:
------------------------------

    Attachment: pom.xml

Sorry about this, I had the wrong version of the pom in that patch (was playing around with a few options in there)

> Improved Freemarker scripting support through adding wrappers for JCR Nodes and Properties
> ------------------------------------------------------------------------------------------
>
>                 Key: SLING-552
>                 URL: https://issues.apache.org/jira/browse/SLING-552
>             Project: Sling
>          Issue Type: Improvement
>          Components: Scripting
>            Reporter: Bryce Ewing
>            Priority: Minor
>         Attachments: freemarkerwrapper.patch, pom.xml
>
>
> Add freemarker wrapper classes for JCR Node's and Property's, I will be adding further support as I require it but thought I would put in an initial version of this.
> These wrappers provides freemarker support similar to what freemarker does with XML nodes, e.g.:
>   * properties of a node can be accessed as @property_name, e.g. ${currentNode.@title} will output the title property of the current node
>   * child nodes can be accessed directly via "." e.g. ${currentNode.section.@title} will output the title property of the child node of the current node named "section"
>   * child nodes can be iterated over, e.g. <#list currentNode as child>${child.@title}</#list> will iterate over the child nodes of current node outputting the title property
>   * multi value property nodes can be iterated over, <#list currentNode.@multiValue as value>....</#list>
> I haven't tested this yet but processing nodes through macro's, as described for xml here: http://freemarker.sourceforge.net/docs/xgui_declarative_basics.html should also work.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (SLING-552) Improved Freemarker scripting support through adding wrappers for JCR Nodes and Properties

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

Bryce Ewing updated SLING-552:
------------------------------

    Attachment:     (was: freemarkerwrapper.patch)

> Improved Freemarker scripting support through adding wrappers for JCR Nodes and Properties
> ------------------------------------------------------------------------------------------
>
>                 Key: SLING-552
>                 URL: https://issues.apache.org/jira/browse/SLING-552
>             Project: Sling
>          Issue Type: Improvement
>          Components: Scripting
>            Reporter: Bryce Ewing
>            Priority: Minor
>         Attachments: freemarkerwrappers.patch
>
>
> Add freemarker wrapper classes for JCR Node's and Property's, I will be adding further support as I require it but thought I would put in an initial version of this.
> These wrappers provides freemarker support similar to what freemarker does with XML nodes, e.g.:
>   * properties of a node can be accessed as @property_name, e.g. ${currentNode.@title} will output the title property of the current node
>   * child nodes can be accessed directly via "." e.g. ${currentNode.section.@title} will output the title property of the child node of the current node named "section"
>   * child nodes can be iterated over, e.g. <#list currentNode as child>${child.@title}</#list> will iterate over the child nodes of current node outputting the title property
>   * multi value property nodes can be iterated over, <#list currentNode.@multiValue as value>....</#list>
> I haven't tested this yet but processing nodes through macro's, as described for xml here: http://freemarker.sourceforge.net/docs/xgui_declarative_basics.html should also work.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (SLING-552) Improved Freemarker scripting support through adding wrappers for JCR Nodes and Properties

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

Bryce Ewing updated SLING-552:
------------------------------

    Attachment: freemarkerwrapper.patch

Added support for treating reference properties as nodes, i.e. if ${currentNode.refNode.@title} is accessed then the refNode property is accessed from currentNode then getNode() is called, dereferencing the reference.  You can still access the refNode property (rather than the node) by accessing ${currentNode.@refNode}

> Improved Freemarker scripting support through adding wrappers for JCR Nodes and Properties
> ------------------------------------------------------------------------------------------
>
>                 Key: SLING-552
>                 URL: https://issues.apache.org/jira/browse/SLING-552
>             Project: Sling
>          Issue Type: Improvement
>          Components: Scripting
>            Reporter: Bryce Ewing
>            Priority: Minor
>         Attachments: freemarkerwrapper.patch, freemarkerwrappers.patch
>
>
> Add freemarker wrapper classes for JCR Node's and Property's, I will be adding further support as I require it but thought I would put in an initial version of this.
> These wrappers provides freemarker support similar to what freemarker does with XML nodes, e.g.:
>   * properties of a node can be accessed as @property_name, e.g. ${currentNode.@title} will output the title property of the current node
>   * child nodes can be accessed directly via "." e.g. ${currentNode.section.@title} will output the title property of the child node of the current node named "section"
>   * child nodes can be iterated over, e.g. <#list currentNode as child>${child.@title}</#list> will iterate over the child nodes of current node outputting the title property
>   * multi value property nodes can be iterated over, <#list currentNode.@multiValue as value>....</#list>
> I haven't tested this yet but processing nodes through macro's, as described for xml here: http://freemarker.sourceforge.net/docs/xgui_declarative_basics.html should also work.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (SLING-552) Improved Freemarker scripting support through adding wrappers for JCR Nodes and Properties

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

Bertrand Delacretaz reassigned SLING-552:
-----------------------------------------

    Assignee: Bertrand Delacretaz

> Improved Freemarker scripting support through adding wrappers for JCR Nodes and Properties
> ------------------------------------------------------------------------------------------
>
>                 Key: SLING-552
>                 URL: https://issues.apache.org/jira/browse/SLING-552
>             Project: Sling
>          Issue Type: Improvement
>          Components: Scripting
>            Reporter: Bryce Ewing
>            Assignee: Bertrand Delacretaz
>            Priority: Minor
>         Attachments: freemarkerwrapper.patch, pom.xml
>
>
> Add freemarker wrapper classes for JCR Node's and Property's, I will be adding further support as I require it but thought I would put in an initial version of this.
> These wrappers provides freemarker support similar to what freemarker does with XML nodes, e.g.:
>   * properties of a node can be accessed as @property_name, e.g. ${currentNode.@title} will output the title property of the current node
>   * child nodes can be accessed directly via "." e.g. ${currentNode.section.@title} will output the title property of the child node of the current node named "section"
>   * child nodes can be iterated over, e.g. <#list currentNode as child>${child.@title}</#list> will iterate over the child nodes of current node outputting the title property
>   * multi value property nodes can be iterated over, <#list currentNode.@multiValue as value>....</#list>
> I haven't tested this yet but processing nodes through macro's, as described for xml here: http://freemarker.sourceforge.net/docs/xgui_declarative_basics.html should also work.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (SLING-552) Improved Freemarker scripting support through adding wrappers for JCR Nodes and Properties

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

Bryce Ewing updated SLING-552:
------------------------------

    Attachment: freemarkerwrappers.patch

> Improved Freemarker scripting support through adding wrappers for JCR Nodes and Properties
> ------------------------------------------------------------------------------------------
>
>                 Key: SLING-552
>                 URL: https://issues.apache.org/jira/browse/SLING-552
>             Project: Sling
>          Issue Type: Improvement
>          Components: Scripting
>            Reporter: Bryce Ewing
>            Priority: Minor
>         Attachments: freemarkerwrappers.patch
>
>
> Add freemarker wrapper classes for JCR Node's and Property's, I will be adding further support as I require it but thought I would put in an initial version of this.
> These wrappers provides freemarker support similar to what freemarker does with XML nodes, e.g.:
>   * properties of a node can be accessed as @property_name, e.g. ${currentNode.@title} will output the title property of the current node
>   * child nodes can be accessed directly via "." e.g. ${currentNode.section.@title} will output the title property of the child node of the current node named "section"
>   * child nodes can be iterated over, e.g. <#list currentNode as child>${child.@title}</#list> will iterate over the child nodes of current node outputting the title property
>   * multi value property nodes can be iterated over, <#list currentNode.@multiValue as value>....</#list>
> I haven't tested this yet but processing nodes through macro's, as described for xml here: http://freemarker.sourceforge.net/docs/xgui_declarative_basics.html should also work.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.