[jira] [Commented] (SLING-8655) Add an Annotation to Sling Model to mark a property to be Externalized

2019-08-29 Thread Andreas Schaefer (Jira)


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

Andreas Schaefer commented on SLING-8655:
-

I updated the PRs with an updated version that provides a Json Serializer. This 
was not to do as the serializer does not have a reference to OSGi system nor 
does it has access to the underlying resource of the Model.

My expertise is limited when it comes to Sling Models and Jackson and so I 
might have gone awry here. That said I have the most trouble with finding a 
solution for the Annotation Parameters to create an elegant way to tell the 
Externalized Path Provider to get the services it needs but I though with the 
Resource one can get the most out of Sling with adaption and so this is what I 
did.

> Add an Annotation to Sling Model to mark a property to be Externalized
> --
>
> Key: SLING-8655
> URL: https://issues.apache.org/jira/browse/SLING-8655
> Project: Sling
>  Issue Type: New Feature
>  Components: Sling Models
>Affects Versions: Sling Models API 1.3.8
>Reporter: Andreas Schaefer
>Assignee: Andreas Schaefer
>Priority: Major
> Fix For: Sling Models API 1.3.10
>
>  Time Spent: 1h 20m
>  Remaining Estimate: 0h
>
> For Peregrine CMS we use Sling Models to obtain data in JSon format to be 
> rendered on the client side. This means that the returned content is not 
> externalized aka paths are not mapped to the external view.
> Sling Model should have an Annotation (@ExternalizedPath) that marks a 
> property to be externalized when loaded.
> In order to be flexible the Externalized Path Injector should be pluggable so 
> that customers can add their custom Externalized Path Providers if they 
> choose to do so. By default there is a provider that uses the Resource 
> Resolver's map() function.



--
This message was sent by Atlassian Jira
(v8.3.2#803003)


[jira] [Commented] (SLING-8655) Add an Annotation to Sling Model to mark a property to be Externalized

2019-08-28 Thread Stefan Seifert (Jira)


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

Stefan Seifert commented on SLING-8655:
---

i think we are discussing two different aspects here:
* the proposal is about a generic mechanism to externalize properties 
containing a path by putting an annotation on it and probably a hook-in 
mechanism for it. vlad agrees, but proposes to put the switch rather to the 
view level (HTL, json serialization) than the model itself
* radu and myself are arguing whether the approach of just marking a path as 
externalized is enough, or if link validating and externalization as a whole is 
perhaps too complex to be handled by this approach, and is usually done in the 
application code perhaps with the help of additional layers like wcm.io 
url/link handler

are the requirements for externalization this different for SPA vs. non SPA 
applications? the JSON has to contain the externalized links, that is sure, the 
questions on which level/layer this approach is best.

> Add an Annotation to Sling Model to mark a property to be Externalized
> --
>
> Key: SLING-8655
> URL: https://issues.apache.org/jira/browse/SLING-8655
> Project: Sling
>  Issue Type: New Feature
>  Components: Sling Models
>Affects Versions: Sling Models API 1.3.8
>Reporter: Andreas Schaefer
>Assignee: Andreas Schaefer
>Priority: Major
> Fix For: Sling Models API 1.3.10
>
>  Time Spent: 1h 20m
>  Remaining Estimate: 0h
>
> For Peregrine CMS we use Sling Models to obtain data in JSon format to be 
> rendered on the client side. This means that the returned content is not 
> externalized aka paths are not mapped to the external view.
> Sling Model should have an Annotation (@ExternalizedPath) that marks a 
> property to be externalized when loaded.
> In order to be flexible the Externalized Path Injector should be pluggable so 
> that customers can add their custom Externalized Path Providers if they 
> choose to do so. By default there is a provider that uses the Resource 
> Resolver's map() function.



--
This message was sent by Atlassian Jira
(v8.3.2#803003)


[jira] [Commented] (SLING-8655) Add an Annotation to Sling Model to mark a property to be Externalized

2019-08-27 Thread Ruben Reusser (Jira)


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

Ruben Reusser commented on SLING-8655:
--

[~vladb] [~sseifert] [~radu.cotescu] we are mostly looking to externalize for 
an SPA use case - it looks like [~vladb]'s suggestion would work well for that 
- Does it still make sense to add the suggested ExternalizedSerializer to Sling 
as this is probably a use case most client side rendered web apps/sites will 
face at one point?

> Add an Annotation to Sling Model to mark a property to be Externalized
> --
>
> Key: SLING-8655
> URL: https://issues.apache.org/jira/browse/SLING-8655
> Project: Sling
>  Issue Type: New Feature
>  Components: Sling Models
>Affects Versions: Sling Models API 1.3.8
>Reporter: Andreas Schaefer
>Assignee: Andreas Schaefer
>Priority: Major
> Fix For: Sling Models API 1.3.10
>
>  Time Spent: 1h 20m
>  Remaining Estimate: 0h
>
> For Peregrine CMS we use Sling Models to obtain data in JSon format to be 
> rendered on the client side. This means that the returned content is not 
> externalized aka paths are not mapped to the external view.
> Sling Model should have an Annotation (@ExternalizedPath) that marks a 
> property to be externalized when loaded.
> In order to be flexible the Externalized Path Injector should be pluggable so 
> that customers can add their custom Externalized Path Providers if they 
> choose to do so. By default there is a provider that uses the Resource 
> Resolver's map() function.



--
This message was sent by Atlassian Jira
(v8.3.2#803003)


[jira] [Commented] (SLING-8655) Add an Annotation to Sling Model to mark a property to be Externalized

2019-08-27 Thread Stefan Seifert (Jira)


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

Stefan Seifert commented on SLING-8655:
---

yes, i'm also unsure if a PR like this does not fall too short once hitting 
real life link resolving and externalization needs - multi tenancy aware etc. 
it can be much more than just adding a hostname and a ".html" suffix.

we usually do it in the model code - calling a central piece of logic that does 
the resolving, validation, externalization stuff. what is required in detail 
may differ from use case to use case - internal, external links, asset links, 
resources, with selectors etc.

> Add an Annotation to Sling Model to mark a property to be Externalized
> --
>
> Key: SLING-8655
> URL: https://issues.apache.org/jira/browse/SLING-8655
> Project: Sling
>  Issue Type: New Feature
>  Components: Sling Models
>Affects Versions: Sling Models API 1.3.8
>Reporter: Andreas Schaefer
>Assignee: Andreas Schaefer
>Priority: Major
> Fix For: Sling Models API 1.3.10
>
>  Time Spent: 1h 20m
>  Remaining Estimate: 0h
>
> For Peregrine CMS we use Sling Models to obtain data in JSon format to be 
> rendered on the client side. This means that the returned content is not 
> externalized aka paths are not mapped to the external view.
> Sling Model should have an Annotation (@ExternalizedPath) that marks a 
> property to be externalized when loaded.
> In order to be flexible the Externalized Path Injector should be pluggable so 
> that customers can add their custom Externalized Path Providers if they 
> choose to do so. By default there is a provider that uses the Resource 
> Resolver's map() function.



--
This message was sent by Atlassian Jira
(v8.3.2#803003)


[jira] [Commented] (SLING-8655) Add an Annotation to Sling Model to mark a property to be Externalized

2019-08-27 Thread Vlad Bailescu (Jira)


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

Vlad Bailescu commented on SLING-8655:
--

Since externalization is mostly related to the view part (of the MVC), I would 
rather we don't introduce this injector. The raw path can then be used, as 
usual, to get a hold of the resource it points to, while externalization is 
done when rendering the model:

* for HTML, using HTL: something like {code}${model.pagePath @ externalized} 
{code}
* for JSON, using a dedicated serializer: {code}@JsonSerialize(using = 
ExternalizedSerializer.class){code}

> Add an Annotation to Sling Model to mark a property to be Externalized
> --
>
> Key: SLING-8655
> URL: https://issues.apache.org/jira/browse/SLING-8655
> Project: Sling
>  Issue Type: New Feature
>  Components: Sling Models
>Affects Versions: Sling Models API 1.3.8
>Reporter: Andreas Schaefer
>Assignee: Andreas Schaefer
>Priority: Major
> Fix For: Sling Models API 1.3.10
>
>  Time Spent: 1h 20m
>  Remaining Estimate: 0h
>
> For Peregrine CMS we use Sling Models to obtain data in JSon format to be 
> rendered on the client side. This means that the returned content is not 
> externalized aka paths are not mapped to the external view.
> Sling Model should have an Annotation (@ExternalizedPath) that marks a 
> property to be externalized when loaded.
> In order to be flexible the Externalized Path Injector should be pluggable so 
> that customers can add their custom Externalized Path Providers if they 
> choose to do so. By default there is a provider that uses the Resource 
> Resolver's map() function.



--
This message was sent by Atlassian Jira
(v8.3.2#803003)


[jira] [Commented] (SLING-8655) Add an Annotation to Sling Model to mark a property to be Externalized

2019-08-27 Thread Radu Cotescu (Jira)


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

Radu Cotescu commented on SLING-8655:
-

[~schaefa], I quickly reviewed the PRs and I'm not really convinced we need an 
injector + a new API for this use-case. IMO link externalization cannot be 
solved with a one-bullet solution. It's a personal opinion, but I really like 
what Provision has done at [1] and I think that externalization is a 
site-specific task (contrary to instance-specific). Continuing this reasoning, 
I'd suggest to handle externalization directly in the application code.

For JSON you could build your own JSON serializer and mark the path properties 
as being serialized with it.

[1] - [https://wcm.io/handler/url/general-concepts.html]

> Add an Annotation to Sling Model to mark a property to be Externalized
> --
>
> Key: SLING-8655
> URL: https://issues.apache.org/jira/browse/SLING-8655
> Project: Sling
>  Issue Type: New Feature
>  Components: Sling Models
>Affects Versions: Sling Models API 1.3.8
>Reporter: Andreas Schaefer
>Assignee: Andreas Schaefer
>Priority: Major
> Fix For: Sling Models API 1.3.10
>
>  Time Spent: 1h 20m
>  Remaining Estimate: 0h
>
> For Peregrine CMS we use Sling Models to obtain data in JSon format to be 
> rendered on the client side. This means that the returned content is not 
> externalized aka paths are not mapped to the external view.
> Sling Model should have an Annotation (@ExternalizedPath) that marks a 
> property to be externalized when loaded.
> In order to be flexible the Externalized Path Injector should be pluggable so 
> that customers can add their custom Externalized Path Providers if they 
> choose to do so. By default there is a provider that uses the Resource 
> Resolver's map() function.



--
This message was sent by Atlassian Jira
(v8.3.2#803003)


[jira] [Commented] (SLING-8655) Add an Annotation to Sling Model to mark a property to be Externalized

2019-08-26 Thread Andreas Schaefer (Jira)


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

Andreas Schaefer commented on SLING-8655:
-

Adjusted the PRs to reflect the changes requested by the reviewer

> Add an Annotation to Sling Model to mark a property to be Externalized
> --
>
> Key: SLING-8655
> URL: https://issues.apache.org/jira/browse/SLING-8655
> Project: Sling
>  Issue Type: New Feature
>  Components: Sling Models
>Affects Versions: Sling Models API 1.3.8
>Reporter: Andreas Schaefer
>Assignee: Andreas Schaefer
>Priority: Major
> Fix For: Sling Models API 1.3.10
>
>  Time Spent: 1h 20m
>  Remaining Estimate: 0h
>
> For Peregrine CMS we use Sling Models to obtain data in JSon format to be 
> rendered on the client side. This means that the returned content is not 
> externalized aka paths are not mapped to the external view.
> Sling Model should have an Annotation (@ExternalizedPath) that marks a 
> property to be externalized when loaded.
> In order to be flexible the Externalized Path Injector should be pluggable so 
> that customers can add their custom Externalized Path Providers if they 
> choose to do so. By default there is a provider that uses the Resource 
> Resolver's map() function.



--
This message was sent by Atlassian Jira
(v8.3.2#803003)


[jira] [Commented] (SLING-8655) Add an Annotation to Sling Model to mark a property to be Externalized

2019-08-23 Thread Andreas Schaefer (Jira)


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

Andreas Schaefer commented on SLING-8655:
-

Create PRs for this:

Sling Models API: 
https://github.com/apache/sling-org-apache-sling-models-api/pull/2

Sling Models Impl: 
https://github.com/apache/sling-org-apache-sling-models-impl/pull/14

> Add an Annotation to Sling Model to mark a property to be Externalized
> --
>
> Key: SLING-8655
> URL: https://issues.apache.org/jira/browse/SLING-8655
> Project: Sling
>  Issue Type: New Feature
>  Components: Sling Models
>Affects Versions: Sling Models API 1.3.8
>Reporter: Andreas Schaefer
>Assignee: Andreas Schaefer
>Priority: Major
> Fix For: Sling Models API 1.3.10
>
>  Time Spent: 20m
>  Remaining Estimate: 0h
>
> For Peregrine CMS we use Sling Models to obtain data in JSon format to be 
> rendered on the client side. This means that the returned content is not 
> externalized aka paths are not mapped to the external view.
> Sling Model should have an Annotation (@ExternalizedPath) that marks a 
> property to be externalized when loaded.
> In order to be flexible the Externalized Path Injector should be pluggable so 
> that customers can add their custom Externalized Path Providers if they 
> choose to do so. By default there is a provider that uses the Resource 
> Resolver's map() function.



--
This message was sent by Atlassian Jira
(v8.3.2#803003)