[jira] [Assigned] (SLING-9458) Support Feature Model files inside a JAR File

2020-05-19 Thread Andreas Schaefer (Jira)


 [ 
https://issues.apache.org/jira/browse/SLING-9458?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Andreas Schaefer reassigned SLING-9458:
---

Assignee: Andreas Schaefer

> Support Feature Model files inside a JAR File
> -
>
> Key: SLING-9458
> URL: https://issues.apache.org/jira/browse/SLING-9458
> Project: Sling
>  Issue Type: Improvement
>  Components: Feature Model
>Affects Versions: Feature Model 1.2.0
>Reporter: Andreas Schaefer
>Assignee: Andreas Schaefer
>Priority: Major
> Fix For: Feature Model 1.2.2
>
>
> A Feature Model file cannot be passed to the Feature Model when inside a JAR 
> file (jar:file:/...!/feature-model-file.json).
> As we already have Feature Archive that needs to obtain the Feature Model 
> file from within its FAR (JAR) file this might be useful there as well.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


Update of a Read-Only Sling Instance with Composite Node

2020-05-19 Thread Andreas Schaefer
Hi

[SOLUTION]: I got this fixed by deleting the Sling (launcher) instance on every 
startup. Not sure where the configuration is set and if there is a way to avoid 
this. Still I would love to know why this failed.

I am trying to update a Sling instance with a partial read-only composite node 
store but ran into issues with it.

What I did:

- Create a Sling 12 instance (seed)
- Restart Sling with the Composite Nodestore (runtime)
- Stopped Sling
- Copied away the read-only nodestore
- Started Sling with the seed configuration to rebuild the read-only part

Here I am seeing a failure because Oak still thinks this is a read-only 
nodestore:

ERROR: bundle org.apache.jackrabbit.oak-store-composite:1.26.0 
(78)[org.apache.jackrabbit.oak.composite.CompositeNodeStoreService(79)] : The 
bindNodeStore method has thrown an exception
java.lang.IllegalArgumentException: Following partial mounts are write-enabled: 
 [[libs]]
at 
com.google.common.base.Preconditions.checkArgument(Preconditions.java:120)
at 
org.apache.jackrabbit.oak.composite.CompositeNodeStore.assertPartialMountsAreReadOnly(CompositeNodeStore.java:127)
at 
org.apache.jackrabbit.oak.composite.CompositeNodeStore.(CompositeNodeStore.java:106)
at 
org.apache.jackrabbit.oak.composite.CompositeNodeStore$Builder.build(CompositeNodeStore.java:442)
at 
org.apache.jackrabbit.oak.composite.CompositeNodeStoreService.registerCompositeNodeStore(CompositeNodeStoreService.java:191)
at 
org.apache.jackrabbit.oak.composite.CompositeNodeStoreService.bindNodeStore(CompositeNodeStoreService.java:272)

Cheers - Andy

[jira] [Created] (SLING-9458) Support Feature Model files inside a JAR File

2020-05-19 Thread Andreas Schaefer (Jira)
Andreas Schaefer created SLING-9458:
---

 Summary: Support Feature Model files inside a JAR File
 Key: SLING-9458
 URL: https://issues.apache.org/jira/browse/SLING-9458
 Project: Sling
  Issue Type: Improvement
  Components: Feature Model
Affects Versions: Feature Model 1.2.0
Reporter: Andreas Schaefer
 Fix For: Feature Model 1.2.2


A Feature Model file cannot be passed to the Feature Model when inside a JAR 
file (jar:file:/...!/feature-model-file.json).

As we already have Feature Archive that needs to obtain the Feature Model file 
from within its FAR (JAR) file this might be useful there as well.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Resolved] (SLING-9457) Nested loops without an item identifier generate a Java compilation error

2020-05-19 Thread Radu Cotescu (Jira)


 [ 
https://issues.apache.org/jira/browse/SLING-9457?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Radu Cotescu resolved SLING-9457.
-
Resolution: Fixed

Fixed in [commit 
ba8e83a|https://github.com/apache/sling-org-apache-sling-scripting-sightly-compiler-java/commit/ba8e83a].

> Nested loops without an item identifier generate a Java compilation error
> -
>
> Key: SLING-9457
> URL: https://issues.apache.org/jira/browse/SLING-9457
> Project: Sling
>  Issue Type: Bug
>  Components: Scripting
>Reporter: Radu Cotescu
>Assignee: Radu Cotescu
>Priority: Major
> Fix For: Scripting HTL Java Compiler 1.2.0-1.4.0
>
>
> SLING-9142 introduced a 
> [regression|https://github.com/apache/sling-org-apache-sling-scripting-sightly-compiler-java/commit/7476e0e3cad660228dc1e6c6dbc58a0ea5a5baee#diff-d97cfba1ce4a85137e765d5e9c38ebaaL50],
>  where nested loops without an item identifier would generate a Java compiler 
> error, since the nested loop tries to redefine the same local variable.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Created] (SLING-9457) Nested loops without an item identifier generate a Java compilation error

2020-05-19 Thread Radu Cotescu (Jira)
Radu Cotescu created SLING-9457:
---

 Summary: Nested loops without an item identifier generate a Java 
compilation error
 Key: SLING-9457
 URL: https://issues.apache.org/jira/browse/SLING-9457
 Project: Sling
  Issue Type: Bug
  Components: Scripting
Reporter: Radu Cotescu
Assignee: Radu Cotescu
 Fix For: Scripting HTL Java Compiler 1.2.0-1.4.0


SLING-9142 introduced a 
[regression|https://github.com/apache/sling-org-apache-sling-scripting-sightly-compiler-java/commit/7476e0e3cad660228dc1e6c6dbc58a0ea5a5baee#diff-d97cfba1ce4a85137e765d5e9c38ebaaL50],
 where nested loops without an item identifier would generate a Java compiler 
error, since the nested loop tries to redefine the same local variable.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (SLING-9456) Announce presence of JCR users as OSGi services

2020-05-19 Thread Oliver Lietz (Jira)


[ 
https://issues.apache.org/jira/browse/SLING-9456?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17111450#comment-17111450
 ] 

Oliver Lietz commented on SLING-9456:
-

Implementing a health check checking for a technical user is one use case. See 
SLING-5006 also where the intention for allowing all users in 
{{ServiceUserMapped}} is described.
 I'm not trying to _fix_¹ the current service user mapping and validation, but 
I think [~joerghoh] is right: An approach based on OSGi services _would be much 
more reliable and flexible than any other existing_.
 Though we would have to define a common service interface to allow non-JCR 
implementations.

[1] It's just an exercise done at the weekend.

> Announce presence of JCR users as OSGi services
> ---
>
> Key: SLING-9456
> URL: https://issues.apache.org/jira/browse/SLING-9456
> Project: Sling
>  Issue Type: New Feature
>  Components: JCR
>Reporter: Oliver Lietz
>Assignee: Oliver Lietz
>Priority: Major
> Fix For: JCR Presence 1.0.0
>
>
> Same like Resource Presence but on JCR level and for JCR users only.
> See also [~jhoh] on 
> [Twitter|https://twitter.com/joerghoh/status/1260659833558065152].



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (SLING-9456) Announce presence of JCR users as OSGi services

2020-05-19 Thread Jira


[ 
https://issues.apache.org/jira/browse/SLING-9456?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17111326#comment-17111326
 ] 

Jörg Hoh commented on SLING-9456:
-

> Normal users could be useful when a technical user with password is required

Well, I don't get that usecase. Why would you require on Sling side a technical 
user with a password to enable a functionality/service?

> Announce presence of JCR users as OSGi services
> ---
>
> Key: SLING-9456
> URL: https://issues.apache.org/jira/browse/SLING-9456
> Project: Sling
>  Issue Type: New Feature
>  Components: JCR
>Reporter: Oliver Lietz
>Assignee: Oliver Lietz
>Priority: Major
> Fix For: JCR Presence 1.0.0
>
>
> Same like Resource Presence but on JCR level and for JCR users only.
> See also [~jhoh] on 
> [Twitter|https://twitter.com/joerghoh/status/1260659833558065152].



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (SLING-9456) Announce presence of JCR users as OSGi services

2020-05-19 Thread Oliver Lietz (Jira)


[ 
https://issues.apache.org/jira/browse/SLING-9456?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17111315#comment-17111315
 ] 

Oliver Lietz commented on SLING-9456:
-

[~joerghoh], [~rombert], Normal users could be useful when a technical user 
with password is required. The service user mapping also supports normal users. 
The current service user validation is extensible but I haven't seen an 
implementation where non-JCR users are used.

> Announce presence of JCR users as OSGi services
> ---
>
> Key: SLING-9456
> URL: https://issues.apache.org/jira/browse/SLING-9456
> Project: Sling
>  Issue Type: New Feature
>  Components: JCR
>Reporter: Oliver Lietz
>Assignee: Oliver Lietz
>Priority: Major
> Fix For: JCR Presence 1.0.0
>
>
> Same like Resource Presence but on JCR level and for JCR users only.
> See also [~jhoh] on 
> [Twitter|https://twitter.com/joerghoh/status/1260659833558065152].



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (SLING-6203) Create a Maven archetype for content packages

2020-05-19 Thread Robert Munteanu (Jira)


[ 
https://issues.apache.org/jira/browse/SLING-6203?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17111292#comment-17111292
 ] 

Robert Munteanu commented on SLING-6203:


Thanks a lot [~bellingard]!

> Create a Maven archetype for content packages
> -
>
> Key: SLING-6203
> URL: https://issues.apache.org/jira/browse/SLING-6203
> Project: Sling
>  Issue Type: Sub-task
>  Components: General
>Reporter: Robert Munteanu
>Assignee: Robert Munteanu
>Priority: Major
>




--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (SLING-6203) Create a Maven archetype for content packages

2020-05-19 Thread Fabrice Bellingard (Jira)


[ 
https://issues.apache.org/jira/browse/SLING-6203?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17111287#comment-17111287
 ] 

Fabrice Bellingard commented on SLING-6203:
---

Done [~rombert]! => 
https://sonarcloud.io/project/configuration?id=apache_sling-content-package-archetype

> Create a Maven archetype for content packages
> -
>
> Key: SLING-6203
> URL: https://issues.apache.org/jira/browse/SLING-6203
> Project: Sling
>  Issue Type: Sub-task
>  Components: General
>Reporter: Robert Munteanu
>Assignee: Robert Munteanu
>Priority: Major
>




--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (SLING-9456) Announce presence of JCR users as OSGi services

2020-05-19 Thread Robert Munteanu (Jira)


[ 
https://issues.apache.org/jira/browse/SLING-9456?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17111284#comment-17111284
 ] 

Robert Munteanu commented on SLING-9456:


I think we should consolidate this and {{ServiceUserMapped}}, otherwise it's 
confusing.

> Announce presence of JCR users as OSGi services
> ---
>
> Key: SLING-9456
> URL: https://issues.apache.org/jira/browse/SLING-9456
> Project: Sling
>  Issue Type: New Feature
>  Components: JCR
>Reporter: Oliver Lietz
>Assignee: Oliver Lietz
>Priority: Major
> Fix For: JCR Presence 1.0.0
>
>
> Same like Resource Presence but on JCR level and for JCR users only.
> See also [~jhoh] on 
> [Twitter|https://twitter.com/joerghoh/status/1260659833558065152].



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (SLING-9456) Announce presence of JCR users as OSGi services

2020-05-19 Thread Jira


[ 
https://issues.apache.org/jira/browse/SLING-9456?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17111281#comment-17111281
 ] 

Jörg Hoh commented on SLING-9456:
-

I would be already happy if this feature "just" works for system users. I 
cannot think of a usecase where I would create a dependency towards a "generic" 
user.

> Announce presence of JCR users as OSGi services
> ---
>
> Key: SLING-9456
> URL: https://issues.apache.org/jira/browse/SLING-9456
> Project: Sling
>  Issue Type: New Feature
>  Components: JCR
>Reporter: Oliver Lietz
>Assignee: Oliver Lietz
>Priority: Major
> Fix For: JCR Presence 1.0.0
>
>
> Same like Resource Presence but on JCR level and for JCR users only.
> See also [~jhoh] on 
> [Twitter|https://twitter.com/joerghoh/status/1260659833558065152].



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[GitHub] [sling-org-apache-sling-app-cms] sonarcloud[bot] commented on pull request #10: Avoid interaction with tzdata

2020-05-19 Thread GitBox


sonarcloud[bot] commented on pull request #10:
URL: 
https://github.com/apache/sling-org-apache-sling-app-cms/pull/10#issuecomment-630808282


   Kudos, SonarCloud Quality Gate passed!
   
   [](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-app-cms=10=false=BUG)
 [](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-app-cms=10=false=BUG)
 [0 
Bugs](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-app-cms=10=false=BUG)
  
   [](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-app-cms=10=false=VULNERABILITY)
 [](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-app-cms=10=false=VULNERABILITY)
 [0 
Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-app-cms=10=false=VULNERABILITY)
 (and [](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-app-cms=10=false=SECURITY_HOTSPOT)
 [0 Security 
Hotspots](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-app-cms=10=false=SECURITY_HOTSPOT)
 to review)  
   [](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-app-cms=10=false=CODE_SMELL)
 [](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-app-cms=10=false=CODE_SMELL)
 [0 Code 
Smells](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-app-cms=10=false=CODE_SMELL)
   
   [](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-app-cms=10=coverage=list)
 No Coverage information  
   [](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-app-cms=10=duplicated_lines_density=list)
 No Duplication information
   
   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [sling-org-apache-sling-app-cms] bdelacretaz opened a new pull request #10: Avoid interaction with tzdata

2020-05-19 Thread GitBox


bdelacretaz opened a new pull request #10:
URL: https://github.com/apache/sling-org-apache-sling-app-cms/pull/10


   Without this, tzdata asks me for timezone information while building the 
webcache images, and blocks instead of reading my response.



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[jira] [Updated] (SLING-9456) Announce presence of JCR users as OSGi services

2020-05-19 Thread Oliver Lietz (Jira)


 [ 
https://issues.apache.org/jira/browse/SLING-9456?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Oliver Lietz updated SLING-9456:

Description: 
Same like Resource Presence but on JCR level and for JCR users only.

See also [~jhoh] on 
[Twitter|https://twitter.com/joerghoh/status/1260659833558065152].

  was:Same like Resource Presence but on JCR level and for JCR users only.


> Announce presence of JCR users as OSGi services
> ---
>
> Key: SLING-9456
> URL: https://issues.apache.org/jira/browse/SLING-9456
> Project: Sling
>  Issue Type: New Feature
>  Components: JCR
>Reporter: Oliver Lietz
>Assignee: Oliver Lietz
>Priority: Major
> Fix For: JCR Presence 1.0.0
>
>
> Same like Resource Presence but on JCR level and for JCR users only.
> See also [~jhoh] on 
> [Twitter|https://twitter.com/joerghoh/status/1260659833558065152].



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


Re: Release Sling IDE 1.2.4

2020-05-19 Thread Robert Munteanu
On Tue, 2020-05-19 at 13:25 +0200, Konrad Windszus wrote:
> Hi Robert,
> I get the following error when opening your link:
> "The requested board cannot be viewed because it either does not
> exist or you do not have permission to view it."
> I am properly logged in to JIRA though.
> Can you make the filter public?

Ah, sorry, I keep forgetting to do that.

Try now.
Robert



[jira] [Created] (SLING-9456) Announce presence of JCR users as OSGi services

2020-05-19 Thread Oliver Lietz (Jira)
Oliver Lietz created SLING-9456:
---

 Summary: Announce presence of JCR users as OSGi services
 Key: SLING-9456
 URL: https://issues.apache.org/jira/browse/SLING-9456
 Project: Sling
  Issue Type: New Feature
  Components: JCR
Reporter: Oliver Lietz
Assignee: Oliver Lietz
 Fix For: JCR Presence 1.0.0


Same like Resource Presence but on JCR level and for JCR users only.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (SLING-9455) JsonItemWriter

2020-05-19 Thread Robert Munteanu (Jira)


[ 
https://issues.apache.org/jira/browse/SLING-9455?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17111089#comment-17111089
 ] 

Robert Munteanu commented on SLING-9455:


Thanks for raising this issue [~yumeier]. I agree on the need to do this, even 
if I don't know right now what the best solution is :-)

I think that 
https://github.com/apache/sling-org-apache-sling-servlets-get/blob/06d8e1d45c073c35b65adfcd30ed49eb6c592dfa/src/main/java/org/apache/sling/servlets/get/impl/helpers/JsonRenderer.java
 covers most of your use case, except for negative list of properties, right? 
Of course, the problem is that it's not API, but I think it's a good starting 
point.

[~bdelacretaz] - IIUC the use cases are different. While you want to convert 
arbitrary objects, Juerg is looking to convert nodes or resources.

> JsonItemWriter
> --
>
> Key: SLING-9455
> URL: https://issues.apache.org/jira/browse/SLING-9455
> Project: Sling
>  Issue Type: New Feature
>  Components: Commons
>Affects Versions: Commons JSON 2.0.18
> Environment: Sling Starter
>Reporter: Juerg Meier
>Priority: Major
>
> Sling 8 came with an org.apache.sling.commons.json bundle/package. The .jcr 
> sub-package contained two classes:
>  * JsonItemWriter
>  * JsonJcrNode
> (javadoc 
> [here|https://sling.apache.org/apidocs/sling8/org/apache/sling/commons/json/jcr/package-summary.html)
> These two classes allowed for serializing a sling resource to well formated 
> JSON and a JCR node to an org.apache.sling.commons.json.JSONObject, 
> respectively.
> For legal reasons, this package was discontinued and is not present anymore 
> in later versions, including the current Sling 11 version.
> Consequently, Sling 11 lacks of a simple yet application-controllable way to 
> serialize a Resource directly to a JSON string. However, many API calls, used 
> in particular by client-side Javascript frameworks (e.g. for Single Page 
> Apps), rely heavily on JSON.
> Hence, it would be desirable to have the Sling 8 JSON package (or similar) 
> back in Sling. The following functionality should be present to have a 
> flexible JSON generator available within Sling:
>  * direct conversion of Nodes/Resources to a String containing JSON
>  * application control of node recursion levels (child nodes as JSON objects)
>  * should allow to set a negative list of properties (those not to render in 
> the output)
>  * proper rendering of all JCR property types to JSON including
>  ** date format definition (default = ISO8601)
>  ** multi-values support (as JSON arrays)
>  ** proper escaping of special chars in Strings
>  * adding additional string/value pairs by the application (i.e. not 
> originating from the dumped Resource)
> See also thread on the sling-users mailing list starting 12 May 
> 2020/"Resource to json serializing"
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


Re: Release Sling IDE 1.2.4

2020-05-19 Thread Konrad Windszus
Hi Robert,
I get the following error when opening your link:
"The requested board cannot be viewed because it either does not exist or you 
do not have permission to view it."
I am properly logged in to JIRA though.
Can you make the filter public?

Thanks,
Konrad

> On 19. May 2020, at 13:23, Robert Munteanu  wrote:
> 
> On Thu, 2020-05-14 at 13:17 +0200, Robert Munteanu wrote:
>> Hi Konrad,
>> 
>> On Thu, 2020-05-14 at 13:12 +0200, Konrad Windszus wrote:
>>> Hi,
>>> the last release of the Sling IDE is from February 2018. Since then
>>> some issues have been fixed 
>>> https://issues.apache.org/jira/projects/SLING/versions/12342835 <
>>> https://issues.apache.org/jira/projects/SLING/versions/12342835>;;.
>>> WDYT about a new release.
>>> Since signing is tricky I would appreciate if you could take it up
>>> @Robert. Otherwise I would need some hints.
>> 
>> I did not try the codesigning since the restructuring. But I'd be
>> willing to try it, at some point we need to get it done.
>> 
>>> Is any other outstanding issue urgently needed for the next
>>> release?
>> 
>> https://issues.apache.org/jira/browse/SLING-7596 , and help would be
>> welcome as I don't think I can look into this in the following couple
>> of weeks.
> 
> BTW, I've been using the following board to get an overview of what has
> been done for a release and what is still planned.
> 
>  https://issues.apache.org/jira/secure/RapidBoard.jspa?rapidView=54
> 
> Thanks,
> Robert
> 



Re: Release Sling IDE 1.2.4

2020-05-19 Thread Robert Munteanu
On Thu, 2020-05-14 at 13:17 +0200, Robert Munteanu wrote:
> Hi Konrad,
> 
> On Thu, 2020-05-14 at 13:12 +0200, Konrad Windszus wrote:
> > Hi,
> > the last release of the Sling IDE is from February 2018. Since then
> > some issues have been fixed 
> > https://issues.apache.org/jira/projects/SLING/versions/12342835 <
> > https://issues.apache.org/jira/projects/SLING/versions/12342835>;;.
> > WDYT about a new release.
> > Since signing is tricky I would appreciate if you could take it up
> > @Robert. Otherwise I would need some hints.
> 
> I did not try the codesigning since the restructuring. But I'd be
> willing to try it, at some point we need to get it done.
> 
> > Is any other outstanding issue urgently needed for the next
> > release?
> 
> https://issues.apache.org/jira/browse/SLING-7596 , and help would be
> welcome as I don't think I can look into this in the following couple
> of weeks.

BTW, I've been using the following board to get an overview of what has
been done for a release and what is still planned.

  https://issues.apache.org/jira/secure/RapidBoard.jspa?rapidView=54

Thanks,
Robert



[jira] [Commented] (SLING-9455) JsonItemWriter

2020-05-19 Thread Bertrand Delacretaz (Jira)


[ 
https://issues.apache.org/jira/browse/SLING-9455?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17110935#comment-17110935
 ] 

Bertrand Delacretaz commented on SLING-9455:


FWIW, I have similar needs in the GraphQL core module, currently using 
{{json-io}} in the 
[JsonSerializer|https://github.com/apache/sling-org-apache-sling-graphql-core/blob/master/src/main/java/org/apache/sling/graphql/core/json/JsonSerializer.java]
 as that's lightweight and easy to use.

As we are using http://johnzon.apache.org/ in our 
{{org.apache.sling.commons.johnzon}} module it might make sense to use their 
{{Mapper}} for this. I haven't found much documentation about that but Steven 
Walters [provided useful information about 
it|https://lists.apache.org/thread.html/r6d7e2da06f821d816806985c8a6c1cb3820bc011d8fa2ca3a5b8b8cf%40%3Cusers.sling.apache.org%3E]
 on our users lists.

If someone writes code for this I'm happy to try it in the GraphQL core module, 
where I basically need to convert arbitrary objects (not JCR-related) to and 
from JSON.

> JsonItemWriter
> --
>
> Key: SLING-9455
> URL: https://issues.apache.org/jira/browse/SLING-9455
> Project: Sling
>  Issue Type: New Feature
>  Components: Commons
>Affects Versions: Commons JSON 2.0.18
> Environment: Sling Starter
>Reporter: Juerg Meier
>Priority: Major
>
> Sling 8 came with an org.apache.sling.commons.json bundle/package. The .jcr 
> sub-package contained two classes:
>  * JsonItemWriter
>  * JsonJcrNode
> (javadoc 
> [here|https://sling.apache.org/apidocs/sling8/org/apache/sling/commons/json/jcr/package-summary.html)
> These two classes allowed for serializing a sling resource to well formated 
> JSON and a JCR node to an org.apache.sling.commons.json.JSONObject, 
> respectively.
> For legal reasons, this package was discontinued and is not present anymore 
> in later versions, including the current Sling 11 version.
> Consequently, Sling 11 lacks of a simple yet application-controllable way to 
> serialize a Resource directly to a JSON string. However, many API calls, used 
> in particular by client-side Javascript frameworks (e.g. for Single Page 
> Apps), rely heavily on JSON.
> Hence, it would be desirable to have the Sling 8 JSON package (or similar) 
> back in Sling. The following functionality should be present to have a 
> flexible JSON generator available within Sling:
>  * direct conversion of Nodes/Resources to a String containing JSON
>  * application control of node recursion levels (child nodes as JSON objects)
>  * should allow to set a negative list of properties (those not to render in 
> the output)
>  * proper rendering of all JCR property types to JSON including
>  ** date format definition (default = ISO8601)
>  ** multi-values support (as JSON arrays)
>  ** proper escaping of special chars in Strings
>  * adding additional string/value pairs by the application (i.e. not 
> originating from the dumped Resource)
> See also thread on the sling-users mailing list starting 12 May 
> 2020/"Resource to json serializing"
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)