Re: [Question] API Regions Report

2021-12-17 Thread Daniel Klco
FYI I took a crack at adding a webconsole status screen for this:
https://github.com/apache/sling-org-apache-sling-feature-apiregions/pull/16/files.
You can see the format in one of the test artifacts:
https://github.com/apache/sling-org-apache-sling-feature-apiregions/blob/268b43b50f66518a236f345607bdc40c530a780b/src/test/resources/printer/populated.txt

More than happy to take suggestions or improvements, but it seems like it
tells you what you'd want to know as a developer.

On Mon, Dec 6, 2021 at 3:53 AM Roy Teeuwen  wrote:

> Wouldn't it be nice to build a web console interface for this? Looks very
> cumbersome at the moment and after having talks with internal Adobe
> customer support I can already tell you that even support doesn't know how
> api regions work (I asked why a package was not exported in Global, and
> they just showed me a screenshot of the package that it's between the
> exported packages, but that doesn't mean anything anymore if its not in the
> global api region)
>
> Will think about how it should look like if I find the time
>
> On Mon, Aug 23, 2021 at 2:02 PM Daniel Klco  wrote:
>
> > There's a reason for that. :-) I revised the script following your email.
> >
> > Rev 1 used reflection to construct a new RegionConfiguration using the
> > BundleContext.
> >
> > On Mon, Aug 23, 2021, 3:04 AM David Bosschaert <
> david.bosscha...@gmail.com
> > >
> > wrote:
> >
> > > Hi Daniel,
> > >
> > > Only looked at your groovy script after I wrote the mail and I see that
> > it
> > > does pretty much exactly what I described :)
> > > The RegionConfiguration class also allows dynamic changes to the
> > > configuration which can be found via ConfigAdmin.
> > >
> > > Cheers,
> > >
> > > David
> > >
> > > On Sun, 22 Aug 2021 at 22:49, David Bosschaert <
> > david.bosscha...@gmail.com>
> > > wrote:
> > >
> > >> Hi Daniel,
> > >>
> > >> You can find the API Regions definitions via the ResolverHookFactory
> > >> service that implements the API Regions at runtime. Just look for the
> > >> ResolverHookFactory service and then check its *.properties service
> > >> registration properties. They contain the full path of the associated
> > files:
> > >>
> > >> [org.osgi.framework.hooks.resolver.ResolverHookFactory]
> > >> bundles.properties=.../bundles.properties
> > >> features.properties=.../features.properties
> > >> idbsnver.properties=.../idbsnver.properties
> > >> regions.properties=.../regions.properties
> > >>
> > >> These files are the definition of the API Regions behaviour, so you
> can
> > >> use them to generate a report, or look at them to see how the service
> is
> > >> configured.
> > >>
> > >> Kind regards,
> > >>
> > >> David
> > >>
> > >>
> > >> On Sun, 22 Aug 2021 at 18:49, Daniel Klco  wrote:
> > >>
> > >>> All,
> > >>>
> > >>> Is there a way to see a report on the API regions for an instance as
> a
> > >>> consumer / extender of Sling?
> > >>>
> > >>> It seems like all of the information you'd need is in the API Regions
> > >>> Runtime RegionConfiguration[1] class, but that's not in an exposed
> > >>> package.
> > >>>
> > >>> The case I'm thinking of is if you are a customizer of a Sling-based
> > app
> > >>> and are importing a package that was not exposed in the API region of
> > >>> your
> > >>> bundle, how would you diagnose why the package is not resolving even
> > >>> though
> > >>> it is exported? If you don't have direct access to the model used to
> > >>> create
> > >>> that app (or if you aren't familiar with reading model files), I
> can't
> > >>> see
> > >>> how you could diagnose the issue.
> > >>>
> > >>> I wrote up a groovy script to dump this configuration, but, it's more
> > >>> than
> > >>> a little hack-y:
> > >>> https://gist.github.com/klcodanr/28385db0ce6df72be36a4f60b433a8ec
> > >>>
> > >>> If there's not a good way currently, would others see value in
> having a
> > >>> status web console to dump this information?
> > >>>
> > >>> -Dan
> > >>>
> > >>> [1]
> > >>>
> > >>>
> >
> https://github.com/apache/sling-org-apache-sling-feature-apiregions/blob/master/src/main/java/org/apache/sling/feature/apiregions/impl/RegionConfiguration.java
> > >>>
> > >>
> >
>


Re: [Question] API Regions Report

2021-08-23 Thread Daniel Klco
There's a reason for that. :-) I revised the script following your email.

Rev 1 used reflection to construct a new RegionConfiguration using the
BundleContext.

On Mon, Aug 23, 2021, 3:04 AM David Bosschaert 
wrote:

> Hi Daniel,
>
> Only looked at your groovy script after I wrote the mail and I see that it
> does pretty much exactly what I described :)
> The RegionConfiguration class also allows dynamic changes to the
> configuration which can be found via ConfigAdmin.
>
> Cheers,
>
> David
>
> On Sun, 22 Aug 2021 at 22:49, David Bosschaert 
> wrote:
>
>> Hi Daniel,
>>
>> You can find the API Regions definitions via the ResolverHookFactory
>> service that implements the API Regions at runtime. Just look for the
>> ResolverHookFactory service and then check its *.properties service
>> registration properties. They contain the full path of the associated files:
>>
>> [org.osgi.framework.hooks.resolver.ResolverHookFactory]
>> bundles.properties=.../bundles.properties
>> features.properties=.../features.properties
>> idbsnver.properties=.../idbsnver.properties
>> regions.properties=.../regions.properties
>>
>> These files are the definition of the API Regions behaviour, so you can
>> use them to generate a report, or look at them to see how the service is
>> configured.
>>
>> Kind regards,
>>
>> David
>>
>>
>> On Sun, 22 Aug 2021 at 18:49, Daniel Klco  wrote:
>>
>>> All,
>>>
>>> Is there a way to see a report on the API regions for an instance as a
>>> consumer / extender of Sling?
>>>
>>> It seems like all of the information you'd need is in the API Regions
>>> Runtime RegionConfiguration[1] class, but that's not in an exposed
>>> package.
>>>
>>> The case I'm thinking of is if you are a customizer of a Sling-based app
>>> and are importing a package that was not exposed in the API region of
>>> your
>>> bundle, how would you diagnose why the package is not resolving even
>>> though
>>> it is exported? If you don't have direct access to the model used to
>>> create
>>> that app (or if you aren't familiar with reading model files), I can't
>>> see
>>> how you could diagnose the issue.
>>>
>>> I wrote up a groovy script to dump this configuration, but, it's more
>>> than
>>> a little hack-y:
>>> https://gist.github.com/klcodanr/28385db0ce6df72be36a4f60b433a8ec
>>>
>>> If there's not a good way currently, would others see value in having a
>>> status web console to dump this information?
>>>
>>> -Dan
>>>
>>> [1]
>>>
>>> https://github.com/apache/sling-org-apache-sling-feature-apiregions/blob/master/src/main/java/org/apache/sling/feature/apiregions/impl/RegionConfiguration.java
>>>
>>


[Question] API Regions Report

2021-08-22 Thread Daniel Klco
All,

Is there a way to see a report on the API regions for an instance as a
consumer / extender of Sling?

It seems like all of the information you'd need is in the API Regions
Runtime RegionConfiguration[1] class, but that's not in an exposed package.

The case I'm thinking of is if you are a customizer of a Sling-based app
and are importing a package that was not exposed in the API region of your
bundle, how would you diagnose why the package is not resolving even though
it is exported? If you don't have direct access to the model used to create
that app (or if you aren't familiar with reading model files), I can't see
how you could diagnose the issue.

I wrote up a groovy script to dump this configuration, but, it's more than
a little hack-y:
https://gist.github.com/klcodanr/28385db0ce6df72be36a4f60b433a8ec

If there's not a good way currently, would others see value in having a
status web console to dump this information?

-Dan

[1]
https://github.com/apache/sling-org-apache-sling-feature-apiregions/blob/master/src/main/java/org/apache/sling/feature/apiregions/impl/RegionConfiguration.java


Re: JSP - location of generated Java file

2021-05-24 Thread Daniel Klco
Juerg,

The JSP .java files are now saved in the Apache Sling Commons FileSystem
ClassLoader bundle's data directory. You can find them with the Apache
Sling FileSystem Web Console:

http://localhost:8080/system/console/fsclassloader

or at OSGi Console > Sling > File System Class Loader

Regards,
Dan

On Mon, May 24, 2021 at 8:50 AM JCR  wrote:

> Hello
>
> Where do I find the .java file generated from the JSP in Sling?
> It used to be under /var, but that does not seem to be the case anymore
> under Sling11. Composum does not find the pre-compiled file either.
>
> Thanks,
> Juerg
>
>


ReSolve 2021 - May 18th, 2021

2021-03-09 Thread Daniel Klco
We’re excited to announce ReSolve 2021 - a showcase of projects and
solutions built with Apache Sling. .The purpose of ReSolve is to bring
together developers, engineers, architects, innovators, designers, and
adopters of Apache Sling based products and solutions.

ReSolve Conference is taking place on May 18th, 2021

Prerecorded intros to all projects will be featured, followed by live Q
sessions for each.

Presenters will also have a chance to showcase a solution built with Apache
Sling for a challenge they encountered.

We’ll hold a set of roundtable discussions around Apache Sling to examine
issues the projects are facing. The goal of these discussions is to
exchange knowledge and foster collaboration between the multi-tier
projects.

We created a ‘sling awesome’ list at [1] and would love for you to list
yourself on there; and if you do - consider being part of the conference
and present!

Register now at https://www.resolveconf.com as a participant, project, or a
speaker!

Note: a project is defined as either a part of Apache Sling (for example:
testing, distribution, the documentation) or a project using Apache Sling
as a dependency

[1] https://www.resolveconf.com/awesome-sling.html


Re: Apache Sling Commons Messaging Mail

2020-12-28 Thread Daniel Klco
My mistake, I forgot that I made that repo private. I've copied the
relevant configurations here:

https://gist.github.com/klcodanr/41bf7c0e97a9b80b8547684ed0f72444

On Mon, Dec 28, 2020 at 3:46 AM Nicola Cisternino  wrote:

> Hi Dan
> and thank you for replay ...
> ... excuse me ... but ...
>
> https://github.com/klcodanr/danklco.com-site-cna/blob/cloud-native-sling/feature/src/main/features/site.json
> link is broken :-(
>
> Il 12/26/20 5:19 PM, Daniel Klco ha scritto:
> > Hey Nicola,
> >
> > The Apache Sling Commons Messaging Mail bundle uses Commons Crypto to
> > encrypt the password for the SMTP server. You'll need to provide the
> > configuration for Commons Crypto including:
> >
> > -
> >
>  
> org.apache.sling.commons.crypto.jasypt.internal.JasyptRandomIvGeneratorRegistrar
> > -
> >
>  
> org.apache.sling.commons.crypto.jasypt.internal.JasyptRandomSaltGeneratorRegistrar
> > -
> >
>  
> org.apache.sling.commons.crypto.jasypt.internal.JasyptStandardPBEStringCryptoService
> > - org.apache.sling.commons.crypto.internal.FilePasswordProvider
> >
> > You can see the configuration (sans secrets) I use on my personal website
> > here:
> >
> https://github.com/klcodanr/danklco.com-site-cna/blob/cloud-native-sling/feature/src/main/features/site.json
> >
> > Once that's set up correctly you should see an option under the
> 'Available
> > crypto service' here:
> > [serverhost:port]/system/console/sling-commons-crypto-encrypt
> >
> >  From there you can enter your password to encrypt it and use it in
> > the org.apache.sling.commons.messaging.mail.internal.SimpleMailService
> > configuration.
> >
> > Hope that helps!
> > -Dan
> >
> > On Wed, Dec 23, 2020 at 5:36 AM Nicola Cisternino 
> wrote:
> >
> >> Hi all
> >>
> >> I'm trying to compose and send emails (Sling 12) using Apache Sling
> >> Commons Messaging Mail Bundle.
> >> Can someone help me define a complete setup ?
> >> All web examples refer to the use of AEM (CQ Mail service) :-(
> >> I've already:
> >> 1) installed bundle (org.apache.sling.commons.messaging.mail-1.0.0.jar)
> >> 2) solved bundle dependencies installing:
> >> - javax.mail-1.6.2.jar
> >> - org.apache.sling.commons.crypto-1.0.0.jar
> >> - org.apache.sling.commons.messaging-1.0.0.jar
> >> 4) created and saved a "Simple mail service" configuration (configMgr)
> >> 3) created a component using documentation example
> >> (
> https://github.com/apache/sling-org-apache-sling-commons-messaging-mail)
> >>
> >> I don't see any log error ... but ...
> >>
> >> @Reference
> >> MailService mailService;
> >>
> >>  is always null 
> >>
> >> Thanks a lot.
> >> Nicola.
> >>
>
>
> --
> Nicola Cisternino
> CTO - Ergon Project Manager - IT Architect
> Cointa s.r.l.
> Tel. +39 080 9371015
> ncis...@cointa.it
> http://www.cointa.it
>


Re: Apache Sling Commons Messaging Mail

2020-12-26 Thread Daniel Klco
Hey Nicola,

The Apache Sling Commons Messaging Mail bundle uses Commons Crypto to
encrypt the password for the SMTP server. You'll need to provide the
configuration for Commons Crypto including:

   -
   
org.apache.sling.commons.crypto.jasypt.internal.JasyptRandomIvGeneratorRegistrar
   -
   
org.apache.sling.commons.crypto.jasypt.internal.JasyptRandomSaltGeneratorRegistrar
   -
   
org.apache.sling.commons.crypto.jasypt.internal.JasyptStandardPBEStringCryptoService
   - org.apache.sling.commons.crypto.internal.FilePasswordProvider

You can see the configuration (sans secrets) I use on my personal website
here:
https://github.com/klcodanr/danklco.com-site-cna/blob/cloud-native-sling/feature/src/main/features/site.json

Once that's set up correctly you should see an option under the 'Available
crypto service' here:
[serverhost:port]/system/console/sling-commons-crypto-encrypt

>From there you can enter your password to encrypt it and use it in
the org.apache.sling.commons.messaging.mail.internal.SimpleMailService
configuration.

Hope that helps!
-Dan

On Wed, Dec 23, 2020 at 5:36 AM Nicola Cisternino  wrote:

> Hi all
>
> I'm trying to compose and send emails (Sling 12) using Apache Sling
> Commons Messaging Mail Bundle.
> Can someone help me define a complete setup ?
> All web examples refer to the use of AEM (CQ Mail service) :-(
> I've already:
> 1) installed bundle (org.apache.sling.commons.messaging.mail-1.0.0.jar)
> 2) solved bundle dependencies installing:
> - javax.mail-1.6.2.jar
> - org.apache.sling.commons.crypto-1.0.0.jar
> - org.apache.sling.commons.messaging-1.0.0.jar
> 4) created and saved a "Simple mail service" configuration (configMgr)
> 3) created a component using documentation example
> (https://github.com/apache/sling-org-apache-sling-commons-messaging-mail)
>
> I don't see any log error ... but ...
>
> @Reference
> MailService mailService;
>
>  is always null 
>
> Thanks a lot.
> Nicola.
>


Re: Session state management

2020-11-16 Thread Daniel Klco
I wouldn't _think_ so since the IDP should support re-authenticating
the user if they switch servers. I'd look to Cris Rockwell to comment
on this however as he's been driving this implementation.

On Fri, Nov 13, 2020 at 11:10 AM Ben Radey  wrote:
>
> Hey Daniel - that SAML whiteboard project you mention - is sticky load
> balancing a requirement for that to work? We are facing that exact issue
> with our project's setup.
>
> Thanks,
> Ben
>
> On Fri, Nov 13, 2020 at 8:24 AM Daniel Klco  wrote:
>
> > Answers inline below.
> >
> > On Thu, Nov 12, 2020 at 11:22 AM Nicola Cisternino 
> > wrote:
> > >
> > > Hi all
> > > We are newbies and come from world of web containers (which manage the
> > > http session state) so, my question is:
> > > in Sling what is the best (and standard) way to:
> > > 1) login via WS (Servlet) called by a JS frontend
> >
> > Sling supports a pluggable authentication system[1] and includes
> > support for form based[2] authentication. You can invoke the
> > form-based authentication endpoints directly to login / out via JS.
> >
> > > 2) extend (logged) user data with custom info (state management)
> >
> > In Sling, each user has a Resource representation under /home/users.
> > You could create additional child resources underneath the user's home
> > resource to create profile data.
> >
> > > 3) restore the session state in subsequent WS calls (without login
> > > again...)
> >
> > In form-based authentication, Sling uses cookies to keep the Session
> > ID / Sling authentication between requests so this should be
> > transparent. This works well for "sticky" load balancing, but will be
> > challenging if you cannot ensure the user lands on the same server
> > between requests.
> >
> > I would also note, it's best practice to not have Sling be the system
> > of record for user data. Another SSO / user data system will ensure
> > consistency across multiple Sling instances. There's a LDAP support
> > bundle[3] from Jackrabbit Oak (the underlying repository
> > implementation) which can be installed into recent versions of Sling.
> > We also have a work in progress implementation of SAML support in the
> > whiteboard (sandbox project).
> >
> > > Thanks a lot.
> > >
> > > --
> > > Nicola Cisternino
> > > CTO - Ergon Project Manager - IT Architect
> > > Cointa s.r.l.
> > > Tel. +39 080 9371015
> > > ncis...@cointa.it
> > > http://www.cointa.it
> >
> > [1] -
> > https://sling.apache.org/documentation/the-sling-engine/authentication/authentication-framework.html
> > [2] -
> > https://sling.apache.org/documentation/the-sling-engine/authentication/authentication-authenticationhandler/form-based-authenticationhandler.html
> > [3] -
> > https://jackrabbit.apache.org/oak/docs/security/authentication/ldap.html
> >
> >


Re: Session state management

2020-11-13 Thread Daniel Klco
Answers inline below.

On Thu, Nov 12, 2020 at 11:22 AM Nicola Cisternino  wrote:
>
> Hi all
> We are newbies and come from world of web containers (which manage the
> http session state) so, my question is:
> in Sling what is the best (and standard) way to:
> 1) login via WS (Servlet) called by a JS frontend

Sling supports a pluggable authentication system[1] and includes
support for form based[2] authentication. You can invoke the
form-based authentication endpoints directly to login / out via JS.

> 2) extend (logged) user data with custom info (state management)

In Sling, each user has a Resource representation under /home/users.
You could create additional child resources underneath the user's home
resource to create profile data.

> 3) restore the session state in subsequent WS calls (without login
> again...)

In form-based authentication, Sling uses cookies to keep the Session
ID / Sling authentication between requests so this should be
transparent. This works well for "sticky" load balancing, but will be
challenging if you cannot ensure the user lands on the same server
between requests.

I would also note, it's best practice to not have Sling be the system
of record for user data. Another SSO / user data system will ensure
consistency across multiple Sling instances. There's a LDAP support
bundle[3] from Jackrabbit Oak (the underlying repository
implementation) which can be installed into recent versions of Sling.
We also have a work in progress implementation of SAML support in the
whiteboard (sandbox project).

> Thanks a lot.
>
> --
> Nicola Cisternino
> CTO - Ergon Project Manager - IT Architect
> Cointa s.r.l.
> Tel. +39 080 9371015
> ncis...@cointa.it
> http://www.cointa.it

[1] - 
https://sling.apache.org/documentation/the-sling-engine/authentication/authentication-framework.html
[2] - 
https://sling.apache.org/documentation/the-sling-engine/authentication/authentication-authenticationhandler/form-based-authenticationhandler.html
[3] - https://jackrabbit.apache.org/oak/docs/security/authentication/ldap.html


Re: Localized Content

2020-09-04 Thread Daniel Klco
Thanks for clarifying the use case. Sling CMS uses the Sling i18n library
as Robert provided.

The Sling GET servlet which is serving the JSON response is simply reading
the resource value, it will not invoke i18n.

To get your message localized, you would need to either write a script and
use the fmt:[1] tags in JSP or @i18n attribute[2] in HTL or write a servlet
/ Sling Model with the Exporter framework[3] and then use the i18n provider
to retrieve the localized content as shown in the
HTMLValdiatorInsightProvider[4]

Depending on your use case, you may also be interested in Sling Resource
SuperImposing[5] which mirrors a resource structure but allows you to
"superimpose" properties (such as translated values) in that structure. I
have gotten it to work in Sling CMS, but haven't figured out (due to time
constraints) how to get the Sling POST servlet to post to the
*Absolute* resource
rather than the *SuperImposed *one.

Hope that helps!

Regards,
Dan


[1] -
https://docs.oracle.com/javaee/5/jstl/1.1/docs/tlddocs/fmt/tld-summary.html
[2] -
https://github.com/adobe/htl-spec/blob/master/SPECIFICATION.md#123-i18n
[3] -
https://sling.apache.org/documentation/bundles/models.html#exporter-framework-since-130-1
[4] -
https://github.com/apache/sling-org-apache-sling-app-cms/blob/master/core/src/main/java/org/apache/sling/cms/core/insights/impl/providers/HTMLValdiatorInsightProvider.java
[5] - https://github.com/apache/sling-org-apache-sling-superimposing

On Fri, Sep 4, 2020 at 7:55 AM Deepak Dixit  wrote:

> How does sling handle the i18n?
>
> I have a use case:
> - I created a website
> - Able to access its json using
> http://localhost:8080/content/demo/index.infinity.json
> - Now I want to manage the localized content for this site
> - I am sending Accept-Language header while calling the json url
>
> Here is the json output
>
> {
> "jcr:primaryType": "nt:unstructured",
> "jcr:title": "Demo Page",
> "jcr:lastModifiedBy": "admin",
> "sling:template": "/conf/global/site/templates/base-page",
> "sling:taxonomy": "/etc/taxonomy/reference/community",
> "jcr:lastModified": "Fri Sep 04 2020 17:22:17 GMT+0530",
> "sling:resourceType": "reference/components/pages/base",
> "published": true,
> "hideInSitemap": false,
> "container": {
> "jcr:primaryType": "nt:unstructured",
> "richtext": {
> "jcr:primaryType": "nt:unstructured",
> "_wysihtml_mode": "1",
> "text": "This is a test message",
> "sling:resourceType": "sling-cms/components/general/richtext"
> }
> }
> }
>
> Now I want to get the localized content for "This is a test message" .
>
>
>
> Kind Regards,
> --
> Deepak Dixit
>
>
> On Fri, Sep 4, 2020 at 4:52 PM Robert Munteanu  wrote:
>
> > On Fri, 2020-09-04 at 16:48 +0530, Deepak Dixit wrote:
> > > Thanks Robert for quick response,
> > >
> > > Yes I read it, and did some experiments but no luck
> > >
> > > I followed the instruction [1] and setup the sling cms app,
> > > Created new site, added i18n and/or languages but no luck
> >
> > I see. Maybe it's about the way the Sling CMS handles i18n, and that I
> > do not know. Maybe someone else does.
> >
> > Robert
> >
> > >
> > >
> > > [1] https://github.com/apache/sling-org-apache-sling-app-cms
> > > Kind Regards,
> > > --
> > > Deepak Dixit
> > >
> > > On Fri, Sep 4, 2020 at 4:27 PM Robert Munteanu 
> > > wrote:
> > >
> > > > Hi Deepak,
> > > >
> > > > On Fri, 2020-09-04 at 15:38 +0530, Deepak Dixit wrote:
> > > > > Hi Team,
> > > > >
> > > > > How to create localized content using sling?
> > > > >
> > > > > I am exploring sling cms app [1], I want to generate the
> > > > > localized
> > > > > site
> > > > > using sling.
> > > > >
> > > > > Is it possible to generate the localized site using sling?
> > > >
> > > > Have you seen the i18n support from Sling?
> > > >
> > > >
> > > >
> >
> https://sling.apache.org/documentation/bundles/internationalization-support-i18n.html
> > > >
> > > > Thanks,
> > > > Robert
> > > >
> > > >
> >
> >
>


Re: Resource to json serializing

2020-05-11 Thread Daniel Klco
Sounds like a use case for Sling Models Exporter:

https://sling.apache.org/documentation/bundles/models.html#exporter-framework-since-130-1

https://blogs.perficient.com/2018/07/26/no-servlets-required-exporting-data-with-sling-models/

The only caveat is that it's designed for named parameters, if you really
need it to be completely configurable at runtime, I'd suggest creating a
servlet attached to a resource type that filters the current resources
value map and uses Jackson to convert it to a JSON.

On Mon, May 11, 2020 at 4:31 AM JCR  wrote:

> Before I write anything on my own...
>
> Hello
>
> There is this convenient .json extension which produces a JSON
> serialization of any given resource in Sling.
>
> What would be a "best practice" if I only wanted a subset of all
> properties to be serialized on the json stream? That is, I would like to
> provide a "positive" list (lists all props to be exported) or a
> "negative" one (props to be excluded).
>
> Example: I have props a, b and c on a given node/resource and only a and
> c should appear on the output.
>
> Thanks for any pattern hint
> Juerg
>
>


Re: Nodetype management

2020-05-01 Thread Daniel Klco
Interesting, what version of Composum? I'm seeing the following in Composum
1.12.0:

https://imgur.com/a/ahBJpKR

On Thu, Apr 30, 2020 at 4:51 PM JCR  wrote:

> Daniel,
>
> Switching filtering off, the tree does not show jcr:system or similar.
> Also, when I do a search for "system", it makes no difference if a set
> the filter switch to on or off.
>
> Any thoughts?
>
>
> On 28.04.20 14:20, Daniel Klco wrote:
> > Juerg,
> >
> > Try changing the filter (the second icon to the right on below the tree)
> to
> > "unfiltered". The jcr:system node should appear.
> >
> > On Mon, Apr 27, 2020 at 3:24 PM JCR  wrote:
> >
> >> Daniel,
> >>
> >> The path is not found by the Composum browser (no /_jcr_system/ node,
> >> logged in as admin).
> >> Any filtering/setting in the browser to make it visible?
> >>
> >> -Juerg
> >>
> >> On 26.04.20 18:31, Daniel Klco wrote:
> >>> Juerg,
> >>>
> >>> In Sling 11, there's a status console in the OSGi Console which shows
> the
> >>> JCR namespaces:
> >>> http://localhost:8080/system/console/status-JCR%20Namespaces
> >>>
> >>> And you can see the node types via the Composum Node Browser:
> >>> http://localhost:8080/bin/browser.html/_jcr_system/jcr%3AnodeTypes
> >>>
> >>>
> >>>
> >>> On Sun, Apr 26, 2020 at 11:09 AM jcr  wrote:
> >>>
> >>>> Hello
> >>>>
> >>>> Actually a jackrabbit question, but let me this ask here.
> >>>>
> >>>> Is there a browser or similar to list and/or manage the JCR nodetypes
> in
> >>>> sling 11?
> >>>>
> >>>> Thanks,
> >>>> Juerg
> >>>>
> >>>>
> >>
>
>


Re: Nodetype management

2020-04-28 Thread Daniel Klco
Juerg,

Try changing the filter (the second icon to the right on below the tree) to
"unfiltered". The jcr:system node should appear.

On Mon, Apr 27, 2020 at 3:24 PM JCR  wrote:

> Daniel,
>
> The path is not found by the Composum browser (no /_jcr_system/ node,
> logged in as admin).
> Any filtering/setting in the browser to make it visible?
>
> -Juerg
>
> On 26.04.20 18:31, Daniel Klco wrote:
> > Juerg,
> >
> > In Sling 11, there's a status console in the OSGi Console which shows the
> > JCR namespaces:
> > http://localhost:8080/system/console/status-JCR%20Namespaces
> >
> > And you can see the node types via the Composum Node Browser:
> > http://localhost:8080/bin/browser.html/_jcr_system/jcr%3AnodeTypes
> >
> >
> >
> > On Sun, Apr 26, 2020 at 11:09 AM jcr  wrote:
> >
> >> Hello
> >>
> >> Actually a jackrabbit question, but let me this ask here.
> >>
> >> Is there a browser or similar to list and/or manage the JCR nodetypes in
> >> sling 11?
> >>
> >> Thanks,
> >> Juerg
> >>
> >>
>
>


Re: Nodetype management

2020-04-26 Thread Daniel Klco
Juerg,

In Sling 11, there's a status console in the OSGi Console which shows the
JCR namespaces:
http://localhost:8080/system/console/status-JCR%20Namespaces

And you can see the node types via the Composum Node Browser:
http://localhost:8080/bin/browser.html/_jcr_system/jcr%3AnodeTypes



On Sun, Apr 26, 2020 at 11:09 AM jcr  wrote:

> Hello
>
> Actually a jackrabbit question, but let me this ask here.
>
> Is there a browser or similar to list and/or manage the JCR nodetypes in
> sling 11?
>
> Thanks,
> Juerg
>
>


Re: Sling Slack Channel

2020-04-21 Thread Daniel Klco
Chris,

I agree, I'd be 100% on board with a Slack channel for Sling. A couple
thoughts:

 - There is already a slack org for the ASF: the-asf.slack.com we could use
rather than setting up another slack org
 - We probably should call a formal vote rather than asking for replies in
this thread

Regards,
Dan


On Tue, Apr 21, 2020 at 12:07 PM Cris Rockwell  wrote:

> I’ve read thread [1] and have a few observations:
>
> 1. It happened on the Sling Dev email list. Sling Dev has too many daily
> emails. The context and substance of most messages are difficult to
> understand unless you’re already fully entrenched. I unsubscribed pretty
> quick. It is not the best platform for all collaboration across the project
> community.
>
> 2. To summarize the respondents of thread [1] every non-Adobe responder in
> the thread wanted Slack. Adobe already has a company chat platform. More
> collaboration across organizational boundaries would be a good thing for
> the project.
>
> 3. There was no vote. Why don’t we use the decision making process for
> Apache Software Foundation projects [2]?
>
> Let’s put it to a vote and let the Sling Users have a say. Respond with +1
> if you want a Slack Workspace for the Sling Community. Of course use of
> Slack is optional, so there is no need to vote against. Don’t join unless
> you want to!
>
> Cris Rockwell
> Applications Architect Sr
> College of Literature, Science, and the Arts | University of Michigan
> LSA Technology Services | 301 E Liberty Suite 500 | Ann Arbor, MI 48104
> Desk: 734.763.6818 | Email: cmroc...@umich.edu 
>
> [2]:  https://www.apache.org/foundation/how-it-works.html#decision-making
> 
>
>
>
>
> > On Apr 20, 2020, at 4:04 AM, Robert Munteanu  > wrote:
> >
> > Hi Cris,
> >
> > On Sat, 2020-04-18 at 11:03 -0400, Cris Rockwell wrote:
> >> Hi Sling Users
> >>
> >> Is there a community chat platform like Slack or gitter for Sling
> >> users and developers?
> >
> > Not at the moment. See also [1] where we had this discussion and
> > eventually abandoned the idea.
> >
> > Thanks,
> > Robert
> >
> > [1]:
> https://lists.apache.org/thread.html/r19665a94cb17d9b7607eb9c5fe4c91cfa1df8eed55219f2db9b53f05%40%3Cdev.sling.apache.org%3E
> <
> https://lists.apache.org/thread.html/r19665a94cb17d9b7607eb9c5fe4c91cfa1df8eed55219f2db9b53f05%40%3Cdev.sling.apache.org%3E
> >
> >
> >>
> >> Cris
> >>
> >
>
>


Re: [VOTE] Release Apache Sling CMS version 0.16.2

2020-04-14 Thread Daniel Klco
+1

On Tue, Apr 14, 2020, 2:43 PM Daniel Klco  wrote:

> Hi,
>
> We solved 3 issues in this release:
> https://issues.apache.org/jira/projects/SLING/versions/12347829
>
> Staging repository:
> https://repository.apache.org/content/repositories/orgapachesling-2239/
>
> You can use this UNIX script to download the release and verify the
> signatures:
>
> https://gitbox.apache.org/repos/asf?p=sling-tooling-release.git;a=blob;f=check_staged_release.sh;hb=HEAD
>
> Usage:
> sh check_staged_release.sh 2239 /tmp/sling-staging
>
> Please vote to approve this release:
>
>   [ ] +1 Approve the release
>   [ ]  0 Don't care
>   [ ] -1 Don't release, because ...
>
> This majority vote is open for at least 72 hours.
>


Repoinit Classpath

2020-04-06 Thread Daniel Klco
I'm looking into executing a Repoinit script from the classpath of a bundle
upon installation using the references property, but can't work out the
correct format.

According to the docs:
https://sling.apache.org/documentation/bundles/repository-initialization.html

It looks like I should be able to specify any URL, but I'm not seeing how
it would be possible to get a reference to a resource in a bundle.

I tried a couple variants, such as:

references=["jar:[pid]-[version].jar!/provisioning/model.txt"]
references=["jar:inputstream:[pid]-[version].jar!/provisioning/model.txt"]
references=["classpath:/provisioning/model.txt"]

I could think of how to reference it by a file:// URL, but that wouldn't be
stable between different instances.


Re: OIDC or SAML2 for Sling

2020-02-25 Thread Daniel Klco
Hey Chris,

This looks like a really good start! A couple of thoughts:

   - It looks like a lot of exceptions are re-thrown as Runtime exceptions
   which IMO tends to obscure expected exception handling, it looks like this
   is WIP, but wanted to call it out
   - You may want to look at the Dynamic Class Loader Manager:
   
https://sling.apache.org/apidocs/sling8/org/apache/sling/commons/classloader/DynamicClassLoaderManager.html
   - One thing to think about is how to store group membership. Due to a
   certain project that some of the Jackrabbit folks are aware of, I've found
   out quite painfully that the default Jackrabbit group membership has a hard
   limit to the number of user -> group associations before performance gets
   geometrically worse. You'll want to make sure your implementation supports
   dynamic group membership if your user count is going to get into the
   hundreds of thousands:
   
https://jackrabbit.apache.org/oak/docs/security/authentication/external/dynamic.html

Hope this helps and thanks for taking this on!

On Tue, Feb 25, 2020 at 5:14 AM Robert Munteanu  wrote:

> Hi Cris,
>
> I am away until 9/3, I'll only be able to look into this then. Thanks!
> Robert
>
> Sent from Nine
> 
> From: Cris Rockwell 
> Sent: Monday, 24 February 2020 19:07
> To: users@sling.apache.org
> Subject: Re: OIDC or SAML2 for Sling
>
> Hi Robert
>
> I sent an email to d...@sling.apache.org  on
> 2/20/2020, but I can’t find my message in the Dev Sling Mail Archive <
> http://apache-sling.73963.n3.nabble.com/template/NamlServlet.jtp?macro=search_page=73966=SAML2=0>….
> Maybe this email group only allows messages from certain approved people.
> Whatever the reason, I’m responding to you again over Sling Users.
>
> I continue my work on to donate 'SAML2 Authentication Handler for Apache
> Sling’ to the Apache Sling Whiteboard. The project is  is located at...
>
> https://github.com/cmrockwell/sling-whiteboard-saml/tree/sling-saml2-service-provider/saml-handler
> <
> https://github.com/cmrockwell/sling-whiteboard-saml/tree/sling-saml2-service-provider/saml-handler>
>
>
> 1. the implementation of the sample project <
> https://bitbucket.org/srasmusson/webprofile-ref-project-v3/src/master/>
> from A Guide to OpenSAML V3 eBook  is added
> and functional as an AuthenticationHandler within Apache Sling, I will open
> a PR. I can recommend this book to anyone looking for a useful and concise
> primer for the OpenSAML V3 Java library.
> 2. next I will try to make use of the Default Sync Handler <
> https://jackrabbit.apache.org/oak/docs/apidocs/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/DefaultSyncHandler.html>
> to manage group membership and user attributes
> 3. also on the todo list, the HTTP POST binding vs SOAP Binding. The
> implementation in step 1 uses SOAP bindings
>
> It would be an honor if any you experienced Sling developers and security
> professionals would review and contribute your thoughts.
>
> Best regards
> Cris Rockwell
> Applications Architect Sr
> College of Literature, Science, and the Arts | University of Michigan
> LSA Technology Services | 6503 Haven Hall | 505 S. State Street | Ann
> Arbor, MI I 48109
> Desk: 734.763.6818 | Email: cmroc...@umich.edu
>
>
>
> > On Feb 17, 2020, at 5:32 AM, Robert Munteanu 
> wrote:
> >
> > Hi Cris,
> >
> > (Feel free to send back to dev@sling as well, replying privately as you
> > wrote privately).
> >
> > The POM looks good to me. I would suggest moving to the latest parent
> > bundle ( sling-bundle-parent 37 I think ) as it gives you Java 11
> > support and better tooling.
> >
> > Also, we should not introduce new Maven repositories as part of our
> > bundles, since that does not work for every setup. For instance,
> > building behind a 'catch-all' Maven mirror that does not have the
> > custom repository set up will fail. I see that the artifacts you
> > referenced are already on Maven Central, so it's probably just a
> > leftover.
> >
> > As to your choice of library, I think that is fine. I am not very much
> > aware of the current landscape anyway, but as long as the license is
> > fine, it does what we need and has a reasonable community behind it,
> > all is well.
> >
> > What I think would also be helpful is a high-level diagram/explanation
> > of the goals of the bundle, e.g.
> >
> > - will allow Sling applications to authenticate users against Oauth2
> > servers such as 
> > - will allow sync of user attributes from OIDC providers such as ...
> >
> > (I may have gotten these totally wrong due to my lack of knowledge: -)
> > )
> >
> > Thanks!
> >
> > Robert
> >
> >
> > On Fri, 2020-02-14 at 16:33 -0500, Cris Rockwell wrote:
> >> Hi Robert
> >>
> >> I’ve just started the project. Perhaps you can advise about the
> >> project setup.
> >>
> >> The pom.xml
> >>
> 

Re: org.apache.sling.api.resource.Resource from Image File

2020-01-22 Thread Daniel Klco
John, to clarify, the provided link was just an example of how one might
import files into a mock Sling repository for Unit testing with Sling
Mocks. I would not expect you to import it as a dependency in your project.

On Wed, Jan 22, 2020 at 2:31 PM John Kramer 
wrote:

> Looking at the maven repo, it looks like there is no test-jar built:
>
>
> https://github.com/apache/sling-org-apache-sling-app-cms/blob/master/transformer/pom.xml
>
> I can pull down the source and push a test-jar to our local repo, but if
> this is really the best way to implement this, this project should probably
> build a test jar itself.
>
> John Kramer
> Java Software Engineer
> E-Commerce Web Team
> e: john.kra...@panerabread.com <mailto:john.kra...@panera.com>
> m: 314-435-2370
>
> On 1/22/20, 13:02, "Daniel Klco"  wrote:
>
> Warning:  This email originated from outside of Panera. Beware of
> clicking links and attachments.
>
>
> Assuming you are using Sling Mocks, you can load the file in as a
> resource
> into the Sling Context, see:
>
> https://github.com/apache/sling-org-apache-sling-app-cms/blob/master/transformer/src/test/java/org/apache/sling/cms/transformer/helpers/SlingCMSContextHelper.java
>
> https://sling.apache.org/documentation/development/sling-mock.html
>
> On Wed, Jan 22, 2020 at 1:44 PM John Kramer <
> john.kra...@panerabread.com>
> wrote:
>
> > Hi guys,
> >
> > I need to build an org.apache.sling.api.resource.Resource obect from
> a
> > file (specifically a .png file) for the purpose of unit testing.
> >
> > How do I do that?
> >
> > Thanks!
> >
> > John Kramer
> > Java Software Engineer
> > E-Commerce Web Team
> > e: john.kra...@panerabread.com<mailto:john.kra...@panera.com>
> > m: 314-435-2370
> >
>
>
>


Re: org.apache.sling.api.resource.Resource from Image File

2020-01-22 Thread Daniel Klco
Assuming you are using Sling Mocks, you can load the file in as a resource
into the Sling Context, see:
https://github.com/apache/sling-org-apache-sling-app-cms/blob/master/transformer/src/test/java/org/apache/sling/cms/transformer/helpers/SlingCMSContextHelper.java

https://sling.apache.org/documentation/development/sling-mock.html

On Wed, Jan 22, 2020 at 1:44 PM John Kramer 
wrote:

> Hi guys,
>
> I need to build an org.apache.sling.api.resource.Resource obect from a
> file (specifically a .png file) for the purpose of unit testing.
>
> How do I do that?
>
> Thanks!
>
> John Kramer
> Java Software Engineer
> E-Commerce Web Team
> e: john.kra...@panerabread.com
> m: 314-435-2370
>


Re: Content Security Policy Headers

2020-01-10 Thread Daniel Klco
Jason,

Rather than putting the headers in Sling, I'd recommend supplying the CSP
in your caching (httpd etc) layer. Something like this:

Header set X-Frame-Options "ALLOW-FROM https://launch.adobe.com;

   Header set X-XSS-Protection "1; mode=block"

   Header set X-Content-Type-Options "nosniff"

   Header set Feature-Policy "sync-xhr 'self' https://www.danklco.com;

   Header set Content-Security-Policy "default-src https: data:
'unsafe-inline'"


I use this on my personal site and have an A rating:
https://securityheaders.com/?q=https%3A%2F%2Fwww.danklco.com%2F

Regards,
Dan


On Fri, Jan 10, 2020 at 12:26 PM Jason E Bailey  wrote:

> If you're not familiar with them
>
> https://tools.ietf.org/html/rfc7231
> https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP
>
> I'm wondering if anyone has used the CSP to secure javascript and styles
> successfully in Sling and what techniques did they use to get there.
>
> I'm about to raise an issue with our vendor because of lack of support,
> but I like to try to avoid tickets if necessary.
>
> - Jason
>


Re: Hosting Sling

2019-11-07 Thread Daniel Klco
I have a bit, honestly I'd just run it in the cloud.

I'm using a reserved t3a.micro instance for my personal website. I would
say you need at least 1 vCPU and 1GB of memory to keep it up and stable any
less than that and you have to do swapping and that's bad. With a
1-year reservation it's only ~$50 / year.

I'd recommend taking a look at the Vagrant setup for Sling CMS as there's
some good stuff in there around configuring Apache httpd to act as a proxy
and caching layer. I'd also just recommend taking a look at Sling CMS as
it's a pretty nice quickstart to getting a working website in Sling.

https://github.com/apache/sling-org-apache-sling-app-cms

On Thu, Nov 7, 2019 at 12:48 PM Andreas Schaefer 
wrote:

> Hi
>
> Does anyone have experience with hosting a small Apache Sling site?
>
> Or is the best solution to run Sling on a Cloud Server (AWS, Azure etc)?
>
> Cheers - Andy
>


Re: A maven archetype for apache sling cms

2019-10-04 Thread Daniel Klco
I have created a first run at a Sling CMS project archetype:
https://github.com/apache/sling-org-apache-sling-app-cms/tree/master/archetype

You should be able to build it with:
mvn clean install

And then use it with:
mvn archetype:generate -DarchetypeGroupId=org.apache.sling
-DarchetypeArtifactId=org.apache.sling.cms.archetype
-DarchetypeVersion=0.12.1-SNAPSHOT

Ruben Reusser has brought up a good point, however, there's an effort to
consolidate the number of archetypes for the Apache Sling project. Before I
release this, I'm going to check with the rest of the team if this is
sufficiently different or should be incorporated into the consolidated
archetype.


On Thu, Oct 3, 2019 at 4:50 PM Daniel Klco  wrote:

> Thanks Chris for bringing this back up. I'd meant to implement such an
> archetype earlier and unfortunately I got distracted. More or less, the
> sling-bundle-archetype or the sling-initial-content-archetype would be good
> starting points, but neither are quite tailored to use with Sling CMS.
>
> I'll put something together, I've been planning on doing a release with
> the most recent updates for awhile now. I've created a ticket to make sure
> it's tracked:
> https://issues.apache.org/jira/browse/SLING-8762
>
> Thanks!
> -Dan
>
> On Thu, Oct 3, 2019 at 3:56 PM Cris Rockwell  wrote:
>
>> Hello all
>>
>> Stumbled upon this email chain in my own search for a maven archetype for
>> apache sling cms. Mr. Klco has posted about such a thing…
>> https://blogs.perficientdigital.com/2018/12/11/building-a-zero-cost-website-with-apache-sling-cms/
>> <
>> https://blogs.perficientdigital.com/2018/12/11/building-a-zero-cost-website-with-apache-sling-cms/
>> >
>>
>> mvn archetype:generate \
>> -DarchetypeGroupId=org.apache.sling \
>> -DarchetypeArtifactId=sling-bundle-archetype \
>> -DarchetypeVersion=1.0.6
>>
>> I’m not sure though, because it post says there would also be starters
>> for JSP and frontend code. The docs for sling-bundle-archetype <
>> https://sling.apache.org/documentation/development/maven-archetypes.html#sling-bundle-archetype>
>> describe it as simple start for a bundle and only has one Java file,
>> SimpleDSComponent (so not a must-module maven project).
>>
>> I think sling-multi-module-maven-project is probably what would users
>> like Mahsum and me.
>>
>> https://robferguson.org/blog/2017/04/16/how-to-build-apache-sling-projects-using-maven/
>> <
>> https://robferguson.org/blog/2017/04/16/how-to-build-apache-sling-projects-using-maven/
>> >
>>
>> If there is better maven archetype for apache sling cms, please let us
>> know.
>>
>> Thank you
>> Cris Rockwell
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> > On Feb 20, 2019, at 7:46 AM, Robert Munteanu 
>> wrote:
>> >
>> > Hi Mahsum,
>> >
>> > On Thu, 2019-02-07 at 12:19 +, Mahsum Demir wrote:
>> >> Hi,
>> >>
>> >> I think having a Maven archetype which generates a simple sling cms
>> >> app will be useful. The generated project will include a simple page
>> >> and a component. The archetype will lessen the time needed to get up
>> >> and working with the cms and increase the popularity of the cms.
>> >>
>> >> So, what do you think about that?
>> >> If you think that is beneficial for the cms too than I would like to
>> >> implement it.
>> >
>> > Do you propose that we:
>> >
>> > - create an archetype for Sling that results in a basic application OR
>> > - create an archetype for the Sling CMS [1]
>> >
>> > ?
>> >
>> >> Also, what is the process of having that project under the Apache
>> >> name?
>> >
>> > Are you asking about contributing this back to Sling? If yes, we are
>> > more than happy to accept your contributions. If this will be a new
>> > module you can send a pull request against the sling whiteboard [2] or
>> > build it in a separate GitHub repository.
>> >
>> > Thanks,
>> >
>> > Robert
>> >
>> >
>> > [1]: https://github.com/apache/sling-org-apache-sling-app-cms
>> > [2]: https://github.com/apache/sling-whiteboard/
>> >
>>
>>


Re: A maven archetype for apache sling cms

2019-10-03 Thread Daniel Klco
Thanks Chris for bringing this back up. I'd meant to implement such an
archetype earlier and unfortunately I got distracted. More or less, the
sling-bundle-archetype or the sling-initial-content-archetype would be good
starting points, but neither are quite tailored to use with Sling CMS.

I'll put something together, I've been planning on doing a release with the
most recent updates for awhile now. I've created a ticket to make sure it's
tracked:
https://issues.apache.org/jira/browse/SLING-8762

Thanks!
-Dan

On Thu, Oct 3, 2019 at 3:56 PM Cris Rockwell  wrote:

> Hello all
>
> Stumbled upon this email chain in my own search for a maven archetype for
> apache sling cms. Mr. Klco has posted about such a thing…
> https://blogs.perficientdigital.com/2018/12/11/building-a-zero-cost-website-with-apache-sling-cms/
> <
> https://blogs.perficientdigital.com/2018/12/11/building-a-zero-cost-website-with-apache-sling-cms/
> >
>
> mvn archetype:generate \
> -DarchetypeGroupId=org.apache.sling \
> -DarchetypeArtifactId=sling-bundle-archetype \
> -DarchetypeVersion=1.0.6
>
> I’m not sure though, because it post says there would also be starters for
> JSP and frontend code. The docs for sling-bundle-archetype <
> https://sling.apache.org/documentation/development/maven-archetypes.html#sling-bundle-archetype>
> describe it as simple start for a bundle and only has one Java file,
> SimpleDSComponent (so not a must-module maven project).
>
> I think sling-multi-module-maven-project is probably what would users like
> Mahsum and me.
>
> https://robferguson.org/blog/2017/04/16/how-to-build-apache-sling-projects-using-maven/
> <
> https://robferguson.org/blog/2017/04/16/how-to-build-apache-sling-projects-using-maven/
> >
>
> If there is better maven archetype for apache sling cms, please let us
> know.
>
> Thank you
> Cris Rockwell
>
>
>
>
>
>
>
>
>
> > On Feb 20, 2019, at 7:46 AM, Robert Munteanu  wrote:
> >
> > Hi Mahsum,
> >
> > On Thu, 2019-02-07 at 12:19 +, Mahsum Demir wrote:
> >> Hi,
> >>
> >> I think having a Maven archetype which generates a simple sling cms
> >> app will be useful. The generated project will include a simple page
> >> and a component. The archetype will lessen the time needed to get up
> >> and working with the cms and increase the popularity of the cms.
> >>
> >> So, what do you think about that?
> >> If you think that is beneficial for the cms too than I would like to
> >> implement it.
> >
> > Do you propose that we:
> >
> > - create an archetype for Sling that results in a basic application OR
> > - create an archetype for the Sling CMS [1]
> >
> > ?
> >
> >> Also, what is the process of having that project under the Apache
> >> name?
> >
> > Are you asking about contributing this back to Sling? If yes, we are
> > more than happy to accept your contributions. If this will be a new
> > module you can send a pull request against the sling whiteboard [2] or
> > build it in a separate GitHub repository.
> >
> > Thanks,
> >
> > Robert
> >
> >
> > [1]: https://github.com/apache/sling-org-apache-sling-app-cms
> > [2]: https://github.com/apache/sling-whiteboard/
> >
>
>


Re: Different Login Landing Page

2019-04-22 Thread Daniel Klco
For the Sling CMS reference, I was able to set the jcr:root with
Sling-Initial-Content in an OSGi bundle:
https://github.com/apache/sling-org-apache-sling-app-cms/blob/master/ui/pom.xml
https://github.com/apache/sling-org-apache-sling-app-cms/blob/master/ui/src/main/resources/jcr_root/ROOT.json


On Mon, Apr 22, 2019 at 5:25 PM Joey Smith  wrote:

> Changing jcr:root via content packages hasn't worked for me since I first
> started using Sling via CQ 5.3; I've never cracked open the code to see
> why.
>
> On Mon, Apr 22, 2019, 13:46 Andreas Schaefer 
> wrote:
>
> > Hi Robert, Chris
> >
> > I don’t want or need to change the login page (that works and we could
> > have a custom icon).
> >
> > That I am looking for is a way to specify where the page goes after the
> > login is successful.
> >
> > OOTB Sling redirects to /content/starter/index.html but I want to have my
> > custom page to come up.
> >
> > As far as I can tell the redirect is done through the sling:target
> > property on the root but I cannot change that through a package
> deployment.
> >
> > - Andy
> >
> > > On Apr 19, 2019, at 9:27 AM, Chris Millar  wrote:
> > >
> > > You can find a working sample at [0] (Requires Sling 8).
> > >
> > > As Robert mentioned, you will need to setup an OSGi configuration [1]
> to
> > > point to your desired login page [2][3].
> > >
> > > Hope this helps!
> > >
> > > [0] https://github.com/auniverseaway/slick-2
> > > [1]
> > >
> >
> https://github.com/auniverseaway/slick-2/blob/master/ui.apps/src/main/resources/jcr_root/apps/slick/install/org.apache.sling.auth.form.FormAuthenticationHandler.json
> > > [2]
> > >
> >
> https://github.com/auniverseaway/slick-2/blob/master/ui.apps/src/main/resources/jcr_root/content/slick/publish/login.json
> > > [3]
> > >
> >
> https://github.com/auniverseaway/slick-2/tree/master/ui.apps/src/main/resources/jcr_root/apps/slick/author/common/login
> > >
> > > On Fri, Apr 19, 2019 at 1:33 AM Robert Munteanu 
> > wrote:
> > >
> > >> Hi Andy,
> > >>
> > >> On Thu, 2019-04-18 at 10:36 -0700, Andreas Schaefer wrote:
> > >>> Hi
> > >>>
> > >>> I am wondering how an application would set a different landing page
> > >>> than the Sling Starter Page?
> > >>>
> > >>> I tried to change the sling:target through a package deployment and
> > >>> it works for /content but not for the root (/).
> > >>
> > >> Have you tried changing the form.login.form property of the
> > >> org.apache.sling.formauth.FormAuthenticationHandler component , as
> > >> described at [1]?
> > >>
> > >> Thanks,
> > >>
> > >> Robert
> > >>
> > >>
> > >> [1]:
> > >>
> >
> https://sling.apache.org/documentation/the-sling-engine/authentication/authentication-authenticationhandler/form-based-authenticationhandler.html#configuration
> > >>
> > >>
> >
> >
>


Re: users@sling.apache.org

2018-09-22 Thread Daniel Klco
For the reference CMS app I put together a vagrant script with Apache httpd
proxying and caching content from Apache Sling using mod_proxy and
mod_cache. You can find it here:

https://github.com/apache/sling-org-apache-sling-app-cms/tree/master/vagrant

On Sat, Sep 22, 2018, 3:51 PM Eric Norman  wrote:

> Are you using sling standalone which has an embedded jetty servlet
> container inside it?  If so, then think the general approach for putting a
> httpd server in front of a jetty based server would be to use mod_proxy as
> a reverse proxy.  You should be able to do a web search for "jetty
> mod_proxy" to see some examples of how that configuration would look in
> httpd.
>
> However, I suspect there may be some limitations (or additional
> configuration) if you are intend to use some newer technologies like http/2
> or websocket with another web server sitting between the client and
> sling/jetty.
>
> Regards,
> -Eric
>
> On Fri, Sep 21, 2018 at 8:58 PM Cris Rockwell  >
> wrote:
>
> > Hello
> > Sling as an application server should work well behind an httpd
> web-server
> > acting as a firewall, proxy and cache layer. Given Sling and Httpd are
> both
> > Apache projects for the web, it seems they are pieces in the same stack.
> > But I'm having trouble finding documentation other than Adobe's
> > mod_dispatcher (which is not OSS afaik). Can anyone recommend resources
> or
> > advice for configuring httpd to work with Sling?
> > Thanks!
> >
>


Re: [DISCUSSION] markdown support for Sling CMS

2018-08-30 Thread Daniel Klco
The Flexmark OSGi Bundle has now been released:

https://search.maven.org/search?q=a:flexmark-osgi

On Sat, Aug 25, 2018 at 8:26 AM Daniel Klco  wrote:

> I just provided a PR against Flexmark to add OSGi support. Assuming that
> gets merged and released, adding markdown support to Sling will be pretty
> easy as it's just installing the flexmark-osgi and jsoup bundles and then
> whatever code we want to wrap around it:
>
> https://github.com/vsch/flexmark-java/pull/261
>
> On Mon, Aug 13, 2018 at 11:07 AM Robert Munteanu 
> wrote:
>
>> Hi Dan,
>>
>> On Thu, 2018-08-09 at 14:06 -0400, Daniel Klco wrote:
>> > Unfortunately, I'm not going to be at adapt.to :-( wrong side of the
>> > pond.
>> >
>> > So for commonmark, I'm assuming you're referring to this one here:
>> >
>> > https://github.com/atlassian/commonmark-java
>> >
>> > We could embed the JAR into a bundle to provide markdown support and
>> > the
>> > implementation of the Sling Models and any other services. Let me
>> > take a
>> > look at it in my copious free time ;-)
>>
>> Have you seen [1]? It's definitely buggy and missing features, but it
>> might work for your use case. In that scenario, we could graduate it
>> from the whiteboard.
>>
>> I'm still waiting for a little time to also allow usage as a
>> ResourceDecorator, and that would allow a lot more flexibility in
>> usage.
>>
>> Robert
>>
>> [1]:
>> https://github.com/apache/sling-whiteboard/tree/master/mdresourceprovider
>> >
>> > On Thu, Aug 9, 2018 at 12:05 PM Ioan Eugen Stan <
>> > stan.ieu...@gmail.com>
>> > wrote:
>> >
>> > > Hello Daniel,
>> > >
>> > > I'm very happy to hear you have a use case for it and I hope we can
>> > > get it
>> > > included soon.
>> > >
>> > > Are you coming to Adapt.to? We might do some work there.
>> > >
>> > > I'm swamped with other work and can't work on this until then. If
>> > > you need
>> > > it sooner, I can't help you much.
>> > >
>> > > Regarding markdown support, I failed to convince commonmark
>> > > developer to
>> > > merge my osgi PR's. Maybe you can push a bit and make it happen. If
>> > > not we
>> > > could try to push for flexmark. The developer might be more open to
>> > > contributions. This is for longer term.
>> > >
>> > > Short term you can use the versions I published.
>> > >
>> > > I saw another discussion about sling and markdown and I saw nice
>> > > features
>> > > being eiscussed (copy front matter properties to jcr properties,
>> > > caching,
>> > > etc) .
>> > >
>> > > https://github.com/vsch/flexmark-java
>> > >
>> > >
>> > > *De la:* dk...@apache.org
>> > > *Trimis:* 9 august 2018 17:59
>> > > *Către:* ieu...@apache.org
>> > > *Cc:* users@sling.apache.org
>> > > *Subiect:* Re: [DISCUSSION] markdown support for Sling CMS
>> > >
>> > > Hey Eugen,
>> > >
>> > > Now that Sling CMS 0.9.0 is out I was thinking adding markdown
>> > > support to
>> > > Sling CMS would be a great addition (in part because I have a use
>> > > case for
>> > > it for filtered user generated content)
>> > >
>> > > I've created an issue for it:
>> > >
>> > > https://issues.apache.org/jira/browse/SLING-7819
>> > >
>> > > Do you want to create a PR for integrating this? How can I help?
>> > >
>> > > Thanks,
>> > > Dan
>> > >
>> > > On Wed, Jun 20, 2018 at 10:16 PM Daniel Klco 
>> > > wrote:
>> > >
>> > > >
>> > > >
>> > > > On Sun, Jun 17, 2018, 9:26 PM Eugen Stan 
>> > > > wrote:
>> > > >
>> > > > > Hello Daniel and all,
>> > > > >
>> > > > > I've been working to deliver a piece of functionality that
>> > > > > leverages
>> > > > > Markdown support and I think it can be a great addition for
>> > > > > managing
>> > > > > content inside a Sling, more specifically Sling CMS.
>> > > > >
>> > > > > My work is by no means ready to be released into the open but I
&

Re: [DISCUSSION] markdown support for Sling CMS

2018-08-25 Thread Daniel Klco
I just provided a PR against Flexmark to add OSGi support. Assuming that
gets merged and released, adding markdown support to Sling will be pretty
easy as it's just installing the flexmark-osgi and jsoup bundles and then
whatever code we want to wrap around it:

https://github.com/vsch/flexmark-java/pull/261

On Mon, Aug 13, 2018 at 11:07 AM Robert Munteanu  wrote:

> Hi Dan,
>
> On Thu, 2018-08-09 at 14:06 -0400, Daniel Klco wrote:
> > Unfortunately, I'm not going to be at adapt.to :-( wrong side of the
> > pond.
> >
> > So for commonmark, I'm assuming you're referring to this one here:
> >
> > https://github.com/atlassian/commonmark-java
> >
> > We could embed the JAR into a bundle to provide markdown support and
> > the
> > implementation of the Sling Models and any other services. Let me
> > take a
> > look at it in my copious free time ;-)
>
> Have you seen [1]? It's definitely buggy and missing features, but it
> might work for your use case. In that scenario, we could graduate it
> from the whiteboard.
>
> I'm still waiting for a little time to also allow usage as a
> ResourceDecorator, and that would allow a lot more flexibility in
> usage.
>
> Robert
>
> [1]:
> https://github.com/apache/sling-whiteboard/tree/master/mdresourceprovider
> >
> > On Thu, Aug 9, 2018 at 12:05 PM Ioan Eugen Stan <
> > stan.ieu...@gmail.com>
> > wrote:
> >
> > > Hello Daniel,
> > >
> > > I'm very happy to hear you have a use case for it and I hope we can
> > > get it
> > > included soon.
> > >
> > > Are you coming to Adapt.to? We might do some work there.
> > >
> > > I'm swamped with other work and can't work on this until then. If
> > > you need
> > > it sooner, I can't help you much.
> > >
> > > Regarding markdown support, I failed to convince commonmark
> > > developer to
> > > merge my osgi PR's. Maybe you can push a bit and make it happen. If
> > > not we
> > > could try to push for flexmark. The developer might be more open to
> > > contributions. This is for longer term.
> > >
> > > Short term you can use the versions I published.
> > >
> > > I saw another discussion about sling and markdown and I saw nice
> > > features
> > > being eiscussed (copy front matter properties to jcr properties,
> > > caching,
> > > etc) .
> > >
> > > https://github.com/vsch/flexmark-java
> > >
> > >
> > > *De la:* dk...@apache.org
> > > *Trimis:* 9 august 2018 17:59
> > > *Către:* ieu...@apache.org
> > > *Cc:* users@sling.apache.org
> > > *Subiect:* Re: [DISCUSSION] markdown support for Sling CMS
> > >
> > > Hey Eugen,
> > >
> > > Now that Sling CMS 0.9.0 is out I was thinking adding markdown
> > > support to
> > > Sling CMS would be a great addition (in part because I have a use
> > > case for
> > > it for filtered user generated content)
> > >
> > > I've created an issue for it:
> > >
> > > https://issues.apache.org/jira/browse/SLING-7819
> > >
> > > Do you want to create a PR for integrating this? How can I help?
> > >
> > > Thanks,
> > > Dan
> > >
> > > On Wed, Jun 20, 2018 at 10:16 PM Daniel Klco 
> > > wrote:
> > >
> > > >
> > > >
> > > > On Sun, Jun 17, 2018, 9:26 PM Eugen Stan 
> > > > wrote:
> > > >
> > > > > Hello Daniel and all,
> > > > >
> > > > > I've been working to deliver a piece of functionality that
> > > > > leverages
> > > > > Markdown support and I think it can be a great addition for
> > > > > managing
> > > > > content inside a Sling, more specifically Sling CMS.
> > > > >
> > > > > My work is by no means ready to be released into the open but I
> > > > > would
> > > > > like to share some ideas and get some feedback. I think it
> > > > > could make a
> > > > > great adition to Sling CMS.
> > > > >
> > > > > I've started from commonsmark-java [1] and I have made some
> > > > > PR's to add
> > > > > proper osgi support and Karaf features. Until they are
> > > > > upstreamed, I've
> > > > > published them to my public repository on bintray so you can
> > > > > test it out
> > > > > [2].
> > &g

Re: [DISCUSSION] markdown support for Sling CMS

2018-08-09 Thread Daniel Klco
Unfortunately, I'm not going to be at adapt.to :-( wrong side of the pond.

So for commonmark, I'm assuming you're referring to this one here:

https://github.com/atlassian/commonmark-java

We could embed the JAR into a bundle to provide markdown support and the
implementation of the Sling Models and any other services. Let me take a
look at it in my copious free time ;-)

On Thu, Aug 9, 2018 at 12:05 PM Ioan Eugen Stan 
wrote:

> Hello Daniel,
>
> I'm very happy to hear you have a use case for it and I hope we can get it
> included soon.
>
> Are you coming to Adapt.to? We might do some work there.
>
> I'm swamped with other work and can't work on this until then. If you need
> it sooner, I can't help you much.
>
> Regarding markdown support, I failed to convince commonmark developer to
> merge my osgi PR's. Maybe you can push a bit and make it happen. If not we
> could try to push for flexmark. The developer might be more open to
> contributions. This is for longer term.
>
> Short term you can use the versions I published.
>
> I saw another discussion about sling and markdown and I saw nice features
> being eiscussed (copy front matter properties to jcr properties, caching,
> etc) .
>
> https://github.com/vsch/flexmark-java
>
>
> *De la:* dk...@apache.org
> *Trimis:* 9 august 2018 17:59
> *Către:* ieu...@apache.org
> *Cc:* users@sling.apache.org
> *Subiect:* Re: [DISCUSSION] markdown support for Sling CMS
>
> Hey Eugen,
>
> Now that Sling CMS 0.9.0 is out I was thinking adding markdown support to
> Sling CMS would be a great addition (in part because I have a use case for
> it for filtered user generated content)
>
> I've created an issue for it:
>
> https://issues.apache.org/jira/browse/SLING-7819
>
> Do you want to create a PR for integrating this? How can I help?
>
> Thanks,
> Dan
>
> On Wed, Jun 20, 2018 at 10:16 PM Daniel Klco  wrote:
>
>>
>>
>> On Sun, Jun 17, 2018, 9:26 PM Eugen Stan  wrote:
>>
>>> Hello Daniel and all,
>>>
>>> I've been working to deliver a piece of functionality that leverages
>>> Markdown support and I think it can be a great addition for managing
>>> content inside a Sling, more specifically Sling CMS.
>>>
>>> My work is by no means ready to be released into the open but I would
>>> like to share some ideas and get some feedback. I think it could make a
>>> great adition to Sling CMS.
>>>
>>> I've started from commonsmark-java [1] and I have made some PR's to add
>>> proper osgi support and Karaf features. Until they are upstreamed, I've
>>> published them to my public repository on bintray so you can test it out
>>> [2].
>>>
>>> I'm currenlty using this functionality to manage terms of use and
>>> privacy policy files for our web platform. We have a requirement that
>>> they need to be translated and I believe that a text based format has
>>> many advantages in this situation than an office document. Most of them
>>> are related to the that:
>>>
>>> - content can be easily version controlled
>>>
>>> - content can be transformed easily into multiple output formats: html,
>>> text, pdf
>>>
>>> - content is easy to view/edit
>>>
>>> - rich text editors exist for markdown that can be added
>>>
>>>
>>> The way I am using it in my application is to register a Sling Model
>>> that allows me to convert from Markdown content to html on the fly
>>> (caching can be added).
>>
>>
>>> I've also defined a script "page/markdown" via sling:resourceType so I
>>> can leverage that functionality. My implementation is based on fling
>>> sample and uses thymeleaf.
>>>
>>> Bellow are some code snippets that I use. My implementation needs to
>>> handle content into multiple languages and we use a fallback mechanism:
>>> If requested language is not available, then we fallback to the default
>>> version - which is English version for most cases.
>>>
>>> 
>>>
>>> @Model(adaptables = {Resource.class, SlingHttpServletRequest.class})
>>> @FieldDefaults(level = AccessLevel.PROTECTED)
>>> public class Page {
>>>
>>>   @SlingObject Resource resource;
>>>
>>>   @SlingObject(injectionStrategy = OPTIONAL)
>>>   SlingHttpServletRequest request;
>>>
>>>   @OSGiService HtmlRenderer htmlRenderer;
>>>   @OSGiService Parser parser;
>>>
>>>   List translations;
>>>
>>>   PageTranslation requested

Re: [DISCUSSION] markdown support for Sling CMS

2018-08-09 Thread Daniel Klco
Hey Eugen,

Now that Sling CMS 0.9.0 is out I was thinking adding markdown support to
Sling CMS would be a great addition (in part because I have a use case for
it for filtered user generated content)

I've created an issue for it:

https://issues.apache.org/jira/browse/SLING-7819

Do you want to create a PR for integrating this? How can I help?

Thanks,
Dan

On Wed, Jun 20, 2018 at 10:16 PM Daniel Klco  wrote:

>
>
> On Sun, Jun 17, 2018, 9:26 PM Eugen Stan  wrote:
>
>> Hello Daniel and all,
>>
>> I've been working to deliver a piece of functionality that leverages
>> Markdown support and I think it can be a great addition for managing
>> content inside a Sling, more specifically Sling CMS.
>>
>> My work is by no means ready to be released into the open but I would
>> like to share some ideas and get some feedback. I think it could make a
>> great adition to Sling CMS.
>>
>> I've started from commonsmark-java [1] and I have made some PR's to add
>> proper osgi support and Karaf features. Until they are upstreamed, I've
>> published them to my public repository on bintray so you can test it out
>> [2].
>>
>> I'm currenlty using this functionality to manage terms of use and
>> privacy policy files for our web platform. We have a requirement that
>> they need to be translated and I believe that a text based format has
>> many advantages in this situation than an office document. Most of them
>> are related to the that:
>>
>> - content can be easily version controlled
>>
>> - content can be transformed easily into multiple output formats: html,
>> text, pdf
>>
>> - content is easy to view/edit
>>
>> - rich text editors exist for markdown that can be added
>>
>>
>> The way I am using it in my application is to register a Sling Model
>> that allows me to convert from Markdown content to html on the fly
>> (caching can be added).
>
>
>> I've also defined a script "page/markdown" via sling:resourceType so I
>> can leverage that functionality. My implementation is based on fling
>> sample and uses thymeleaf.
>>
>> Bellow are some code snippets that I use. My implementation needs to
>> handle content into multiple languages and we use a fallback mechanism:
>> If requested language is not available, then we fallback to the default
>> version - which is English version for most cases.
>>
>> 
>>
>> @Model(adaptables = {Resource.class, SlingHttpServletRequest.class})
>> @FieldDefaults(level = AccessLevel.PROTECTED)
>> public class Page {
>>
>>   @SlingObject Resource resource;
>>
>>   @SlingObject(injectionStrategy = OPTIONAL)
>>   SlingHttpServletRequest request;
>>
>>   @OSGiService HtmlRenderer htmlRenderer;
>>   @OSGiService Parser parser;
>>
>>   List translations;
>>
>>   PageTranslation requestedTranslation;
>>
>>   @PostConstruct
>>   protected void resolveContent() {
>> Locale lang = requestedLanguage();
>> translations = getPageTranslations();
>>
>> log.warn("Parsing translation for resources {}", translations);
>> try {
>>   requestedTranslation = findRequestedTranslationOrUseDefault();
>> } catch (Exception e) {
>>   log.warn("Exception getting content ", e);
>> }
>>   }
>>
>>   private List getPageTranslations() {
>> List translations = new ArrayList<>();
>>
>> resource
>> .getChild("lang")
>> .getChildren()
>> .forEach(
>> resource1 -> {
>>   PageTranslation translation =
>> resource1.adaptTo(PageTranslation.class);
>>   if (translation != null) {
>> translations.add(translation);
>>   }
>> });
>> return translations;
>>   }
>>
>>   public String getTitle() {
>> return requestedTranslation.getTitle();
>>   }
>>
>>   public String getLanguage() {
>> return requestedTranslation.getLanguage();
>>   }
>>
>>   public String getContent() {
>> String content = requestedTranslation.getContent();
>> Node doc = parser.parse(content);
>> return htmlRenderer.render(doc);
>>   }
>>
>> 
>>
>> I'm hoping this can be added to Sling CMS, pending the markdown changes
>> are upstreamed.
>>
>> I believe text based formats are cool and they solve some problems in an
>> interesting way.
>>
>
> I've used markdown a fair b

Re: [DISCUSSION] markdown support for Sling CMS

2018-06-20 Thread Daniel Klco
On Sun, Jun 17, 2018, 9:26 PM Eugen Stan  wrote:

> Hello Daniel and all,
>
> I've been working to deliver a piece of functionality that leverages
> Markdown support and I think it can be a great addition for managing
> content inside a Sling, more specifically Sling CMS.
>
> My work is by no means ready to be released into the open but I would
> like to share some ideas and get some feedback. I think it could make a
> great adition to Sling CMS.
>
> I've started from commonsmark-java [1] and I have made some PR's to add
> proper osgi support and Karaf features. Until they are upstreamed, I've
> published them to my public repository on bintray so you can test it out
> [2].
>
> I'm currenlty using this functionality to manage terms of use and
> privacy policy files for our web platform. We have a requirement that
> they need to be translated and I believe that a text based format has
> many advantages in this situation than an office document. Most of them
> are related to the that:
>
> - content can be easily version controlled
>
> - content can be transformed easily into multiple output formats: html,
> text, pdf
>
> - content is easy to view/edit
>
> - rich text editors exist for markdown that can be added
>
>
> The way I am using it in my application is to register a Sling Model
> that allows me to convert from Markdown content to html on the fly
> (caching can be added).


> I've also defined a script "page/markdown" via sling:resourceType so I
> can leverage that functionality. My implementation is based on fling
> sample and uses thymeleaf.
>
> Bellow are some code snippets that I use. My implementation needs to
> handle content into multiple languages and we use a fallback mechanism:
> If requested language is not available, then we fallback to the default
> version - which is English version for most cases.
>
> 
>
> @Model(adaptables = {Resource.class, SlingHttpServletRequest.class})
> @FieldDefaults(level = AccessLevel.PROTECTED)
> public class Page {
>
>   @SlingObject Resource resource;
>
>   @SlingObject(injectionStrategy = OPTIONAL)
>   SlingHttpServletRequest request;
>
>   @OSGiService HtmlRenderer htmlRenderer;
>   @OSGiService Parser parser;
>
>   List translations;
>
>   PageTranslation requestedTranslation;
>
>   @PostConstruct
>   protected void resolveContent() {
> Locale lang = requestedLanguage();
> translations = getPageTranslations();
>
> log.warn("Parsing translation for resources {}", translations);
> try {
>   requestedTranslation = findRequestedTranslationOrUseDefault();
> } catch (Exception e) {
>   log.warn("Exception getting content ", e);
> }
>   }
>
>   private List getPageTranslations() {
> List translations = new ArrayList<>();
>
> resource
> .getChild("lang")
> .getChildren()
> .forEach(
> resource1 -> {
>   PageTranslation translation =
> resource1.adaptTo(PageTranslation.class);
>   if (translation != null) {
> translations.add(translation);
>   }
> });
> return translations;
>   }
>
>   public String getTitle() {
> return requestedTranslation.getTitle();
>   }
>
>   public String getLanguage() {
> return requestedTranslation.getLanguage();
>   }
>
>   public String getContent() {
> String content = requestedTranslation.getContent();
> Node doc = parser.parse(content);
> return htmlRenderer.render(doc);
>   }
>
> 
>
> I'm hoping this can be added to Sling CMS, pending the markdown changes
> are upstreamed.
>
> I believe text based formats are cool and they solve some problems in an
> interesting way.
>

I've used markdown a fair bit and agree for text heavy use cases.


> What do you think? Daniel, would you help me shape this so it can be
> included in Sling CMS ?


Totally. It'd seem like we'd need to include a markdown editor, script and
model to render the markdown content. That way we could show a HTML editor
and a markdown editor which might be nice from anyone coming from a
markdown too such as Jekyll.

Not related: I haven't seen a Sling CMS feature
> in Sling Karaf features. I would like to add one in the near future.
>

That'd be great!


>
> Other notes: I've targeted asciidoc via asciidoctor but there are issues
> with running asciidoctorj in osgi.
>
> Regards,
>
> Eugen
>
> [1] https://github.com/atlassian/commonmark-java/pulls
>
> [2] https://bintray.com/netdava/maven/commonmark-java
>
>


Re: SQL Resource Provider?

2018-05-02 Thread Daniel Klco
I've been down the path BTW Jason, fun may not be the best description ;-)
Granted this was about 4 years ago now so who knows what has changed. The
biggest problem I had, by far, was that the proprietary API I needed to use
was based on the assumption that it was dealing with JCR backed resources.

On Wed, May 2, 2018 at 8:33 AM, Jason E Bailey  wrote:

> Thought that would be the answer. I'll check out the prototype, thanks.
>
> It'll be fun to write a ResourceProvider for this but it's going to have
> to go to the bottom of my current list of things to get done in
> Sling.
>
> - Jason
>
> On Wed, May 2, 2018, at 6:08 AM, Stefan Seifert wrote:
> > hello jason.
> >
> > if you are using oak you might try the RDBDocumentStore [1] and
> > RDBBlobStore [2] implementation (i've never used them myself).
> >
> > for using a lightweight approach accessing a RDBMS directly from a
> > resource provider the is no support currently afaik.
> > if you are looking for a generic storage of resource data in RDBMS the
> > generic nosql support [3] might be a good starting point (although that
> > is a bit outdated as well and I assume not much used in practice). if
> > you want to write a specific resource provider for a "real data model"
> > stored in RDBMS i did a very rough prototype some years ago, but never
> > used it in real life [4].
> >
> > stefan
> >
> > [1]
> > http://jackrabbit.apache.org/oak/docs/apidocs/org/apache/jac
> krabbit/oak/plugins/document/rdb/RDBDocumentStore.html
> > [2]
> > http://jackrabbit.apache.org/oak/docs/apidocs/org/apache/jac
> krabbit/oak/plugins/document/rdb/RDBBlobStore.html
> > [3]
> > https://sling.apache.org/documentation/bundles/nosql-resourc
> e-providers.html
> > [4] https://adapt.to/2012/en/schedule/apache-sling-rdbms-mapping.html
> >
> >
> > >-Original Message-
> > >From: Jason E Bailey [mailto:j...@apache.org]
> > >Sent: Tuesday, May 1, 2018 9:48 PM
> > >To: users@sling.apache.org
> > >Subject: SQL Resource Provider?
> > >
> > >Has anyone ever used a SQL resource provider or know where I can find
> such
> > >a thing?
> > >
> > >- Jason
> >
>


Re: Daily content sync between environments

2017-10-23 Thread Daniel Klco
On a similar vein, another fun one we did a while back was to vlt co into a
git repo and then blanket add and commit any changes on the hour. That way
we had a snapshot of exactly what was going on in the repository and the
ability to snapshot back any portion of the tree at any time (at a
reasonable granularity level). Very useful in the throes of authoring where
we were training up authors and trying to get a bunch of site content added
at the same time.

On Mon, Oct 23, 2017 at 3:06 PM, Roy Teeuwen  wrote:

> Hey Ioan,
>
> In my initial post I already gave you all the experience I have so for, I
> have tested out 4 different tools (Content Packages, VLT RCP, Grabbit and
> oak-migration tool) and given my benefits and drawbacks.
>
> I will give VLT a try again, but I think seeing as the problem I found
> when first using it through VLT RCP[1], so not the vlt co that Robert and
> Daniel suggested, I am not sure if that one will work out.
> If VLT fails and no other solutions come up, I might probably go for the
> creating a daily content package based on a query which looks for new
> content created that day.
>
> Greets,
> Roy
>
> [1] http://jackrabbit.510166.n4.nabble.com/Filevault-
> OakConstraint0021-Exception-td4666959.html
>
>
> On 23 Oct 2017, at 18:53, Ioan Eugen Stan  wrote:
>
> Hi Roy,
>
> This is a use case that we have as well.
>
> We need to be able to sync content between different instances
> periodically or on request. We are still in the planning phase and will
> start to implement Sling once we have enough resources.
>
> Please share your experience so others can benefit (including us).
>
> In our use case we have an Item Bank with lots of items and other
> content. Most of the time we need to update translations. In some cases
> (once every few months) we need to add/update the content/content
> structure. Translations can be handled in lots of ways, we might not
> even use the vlt solution Robert proposed.  For new content I think that
> is something that will help us.
>
>
> Regards,
>
>
> On 23.10.2017 18:58, Robert Munteanu wrote:
>
> Hi Roy,
>
> On Sun, 2017-10-22 at 19:39 +0200, Roy Teeuwen wrote:
>
> Hey guys,
>
> I didn't know for sure where to put this question so thats why I am
> asking it in both Jackrabbit as in Sling, because both might have
> their own solution / proposal, and I have seen solutions that are
> pure Jackrabbit but some that also require Sling.
>
> I was wondering about what some of you might achieve something like a
> daily content sync between different environments (Production to
> Acceptance/Development for example).
>
> Never tried this, but maybe you can use vlt ci/co? Initially you run
> vlt co against the 'source' instance and then vlt ci against the
> 'target' instance. First time you will sync everything, but then
> operations will be incremental.
>
> You do have to find a clean way of switching the vlt url between
> invocations though.
>
> Robert
>
>
>
>
>


Re: Daily content sync between environments

2017-10-23 Thread Daniel Klco
I've used VLT for this as well. It's nice as you can target the path to
update but it is clunky. From a speed perspective, you could also use an S3
bucket to transfer the content if you are using AWS so each script only
cares about its local environment and you don't need to allow direct access
between servers.

On Mon, Oct 23, 2017 at 11:58 AM, Robert Munteanu 
wrote:

> Hi Roy,
>
> On Sun, 2017-10-22 at 19:39 +0200, Roy Teeuwen wrote:
> > Hey guys,
> >
> > I didn't know for sure where to put this question so thats why I am
> > asking it in both Jackrabbit as in Sling, because both might have
> > their own solution / proposal, and I have seen solutions that are
> > pure Jackrabbit but some that also require Sling.
> >
> > I was wondering about what some of you might achieve something like a
> > daily content sync between different environments (Production to
> > Acceptance/Development for example).
>
> Never tried this, but maybe you can use vlt ci/co? Initially you run
> vlt co against the 'source' instance and then vlt ci against the
> 'target' instance. First time you will sync everything, but then
> operations will be incremental.
>
> You do have to find a clean way of switching the vlt url between
> invocations though.
>
> Robert
>


Re: Bundle based JCR File

2017-03-19 Thread Daniel Klco
Hey Andreas,

Have you checked the log files? The Sling Content Importer will log any
errors encountered in installing content when the bundle is installed. In
general, that concept should be fine, but it would depend on the exact
structure.

There are a couple of Sling-based apps out there which do leverage bundle
content you may want to check out as examples:

https://github.com/auniverseaway/slick-2/tree/master/ui.apps
https://github.com/nateyolles/publick-sling-blog/tree/master/ui

-Dan

On Sun, Mar 19, 2017 at 2:24 PM, Andreas Schaefer  wrote:

> Hi
>
> I want to add a JSon file to Sling as JCR Node (primary type nt:file)
> inside a Bundle Content.
>
> Is that possible and if how does the structure look like:
>
> In the XML based export the structure looks like this:
>
> - my-file (raw file)
> - my-file.dir
> - .content.xml (jcr:root of type nt:file with a jcr:content of
> type nt:resource and the files mime type)
>
> I tried the following:
>
> - my-file
> - my-file.dir.json with a JSon-ified version of the XML)
>
> but that did not work.
>
> Cheers - Andy Schaefer
>
>


Re: json support

2017-02-23 Thread Daniel Klco
Yep, this is supported via the Sling Content Importer:
https://sling.apache.org/documentation/bundles/content-loading-jcr-contentloader.html

As a note, you can do this via bundles or it is also supported via the
import operation in the Sling Post Servlet:
https://sling.apache.org/documentation/bundles/manipulating-content-the-slingpostservlet-servlets-post.html#importing-content-structures

On Thu, Feb 23, 2017 at 9:22 AM, Jason Bailey  wrote:

> I found out recently through github that people are using  json files to
> create content nodes in bundles. Is this something I can do downstream in
> AEM and/or in a package?
>
> Thanks
> -jason
>


Re: Sling Model and Request Parameters

2016-10-10 Thread Daniel Klco
Agreed, it'd be nice to have, but request parameters cannot be included in
the default injectors list for the reason which Stefan lists. Would it make
sense to use the @Source annotation and add support for injectors which are
not considered by default?

On Fri, Oct 7, 2016 at 8:40 AM, Stefan Seifert 
wrote:

> hello christoph.
>
> i currently see no hard reason against it, and implementing such an
> injector+additional annotation would be easy.
>
> it opens a bit more "attack surface" because potentially unsafe data from
> outside is directly injected in your model (perhaps without you noticing it
> when you use the generic @Inject annotation which iterates over all
> injectors for the first match).
>
> so perhaps it would make sense allowing such an injection only when a
> specific @RequestParameter annotation is used.
>
> stefan
>
>
> >-Original Message-
> >From: Christoph Thodte [mailto:christoph.tho...@ht-solutions.de]
> >Sent: Friday, October 7, 2016 12:07 PM
> >To: users@sling.apache.org
> >Subject: Sling Model and Request Parameters
> >
> >Hello!
> >
> >My question to discuss: Why doesn't support Sling Models an adapation from
> >SlingRequest to inject the request parameters (not the request
> attributes).
> >
> >I think form handling will be easier with this adaption.
> >
> >Christoph
>
>


Re: Sling models adaptTo taglib

2016-08-19 Thread Daniel Klco
Roy,

You can pretty safely upgrade the version of Sling Taglibs without
upgrading the overall application version. If you include the newer version
of the bundle into your build package in a folder like
/apps/[app-name]/install, Sling will pick up the more recent version of the
bundle and install it. If you have any issues, you can force Sling to
recompile the JSP's from the OSGi console.

Regards,
Dan

On Fri, Aug 19, 2016 at 7:37 AM, Roy Teeuwen  wrote:

> Hey Júnior,
>
> Thanks!
>
> Darnit, it seems that I will have to wait until after the upgrade to AEM
> 6.2 ;).
>
> Greets,
> Roy
>
>
> > On 19 Aug 2016, at 13:34, Júnior  wrote:
> >
> > Hi Roy,
> >
> > There is an Issue about the problem you are facing:
> >
> > https://issues.apache.org/jira/browse/SLING-5653
> >
> > And it seems to be fixed. Not sure in which version it is included.
> >
> > Thanks
> >
> >
> > 2016-08-19 8:25 GMT-03:00 Roy Teeuwen :
> >
> >> Hello all,
> >>
> >> I am trying to use the sling models taglib, and I am using the following
> >> input:
> >>
> >> <%@ page import=“my.packages.TestModel" %>
> >>
> >>  >> var="model"/>
> >> ${model.testString}
> >>
> >>
> >> But when doing this, I get the following exception:
> >>
> >> java.lang.ClassCastException: java.lang.Object cannot be cast to
> >> java.lang.String
> >>at javax.servlet.jsp.tagext.TagData.getAttributeString(
> >> TagData.java:138)
> >>at org.apache.sling.scripting.jsp.taglib.tei.AdaptToTEI.
> >> getClassName(AdaptToTEI.java:26)
> >>at org.apache.sling.scripting.jsp.taglib.tei.AbstractVarTEI.
> >> getVariableInfo(AbstractVarTEI.java:78)
> >> I would expect this to work? Is there any way I could get it to work
> like
> >> this? It is nicer if I can import it so that my IDE has a clearer sight
> of
> >> which classes are used in the jsp’s instead of having to write the
> class as
> >> a plain string form:
> >>
> >>  >> var="model"/>
> >> ${model.testString}
> >>
> >> (I am used to working with slice from cognifide, and am not trying out
> >> sling models, in slice you could say  >> class=“<%=TestModel.class%>”/> without calling the getName but just
> using
> >> the class object )
> >>
> >> Thanks!
> >> Roy
> >
> >
> >
> >
> > --
> > Francisco Ribeiro
> > *SCEA|SCJP|SCWCD|IBM Certified SOA Associate*
>
>