Re: Fling Installation on Trunk

2017-03-28 Thread Oliver Lietz
On Tuesday 28 March 2017 10:07:00 Andreas Schaefer Sr. wrote:
> Hi Oliver

Hi Andy,

> It would be nice if the Readme would indicate that this is a work in
> progress to avoid users wasting time on a piece that is not ready
> for prime time. As the trunk is probably the first thing people
> get as Sling code this would be helpful I think.

the very first sentence says that this sample is using snapshots. People 
having no experience with Sling should not use trunk but releases.

> In my opinion an example should be plug and play. For anyone
> not very familiar with Sling this is disheartening and can turn them
> away from Sling. I hope that Fling eventually gets there but for
> now I pass as I don’t have the time to look into that (have my own
> little peeve Sling project).

The Fling sample is using modules (from trunk) which cannot be part of 
Launchpad – that means no plug and play with Launchpad (using Sling Karaf 
makes it plug and play though).

Nevertheless it works for others and some find it quite useful. I'm sorry that 
it doesn't work for you.

Regards,
O.

> Thanks - Andy Schaefer
> 
> > On Mar 28, 2017, at 1:22 AM, Oliver Lietz  wrote:
> > 
> > On Monday 27 March 2017 13:05:38 Andreas Schaefer Sr. wrote:
> >> Hi
> >> 
> >> I tried to install Fling from the Samples but failed with the latest
> >> Sling.
> >> 
> >> First I had to install Sling Messaging and Sling Query but then
> >> I gave up on Sling Thymeleaf which has dependencies on
> >> com.fasterxml.jackson.ocre etc that are not deployed in Sling and it also
> >> looks like they are not deployed by any other bundle.
> >> 
> >> A sample does not much good if I cannot build and install it, right?
> > 
> > *sigh
> > 
> >> I am pretty fluent with package dependencies and so if I cannot
> >> figure it out in an acceptable time frame then who will.
> > 
> > Stop whining and start reading, please.
> > 
> >> Any pointers on how to get this working would be very much
> >> appreciated.
> > 
> > The version of Fling is 0.0.1-SNAPSHOT which clearly indicates that it is
> > work in progress. Fling itself depends on some snapshots namely
> > Validation and Messaging (and therefore has to be adjusted sometimes when
> > those dependencies do incompatible changes – see my latest commits).
> > Fling's prerequisites are listed in the README:
> > https://github.com/apache/sling/tree/trunk/samples/fling
> > 
> > How to install Scripting Thymeleaf is described in its README (and btw.
> > Jackson is optional):
> > https://github.com/apache/sling/tree/trunk/contrib/scripting/org.apache.sl
> > ing.scripting.thymeleaf
> > 
> > If you are unable to install those dependencies into Launchpad you can try
> > with Sling's Karaf Distribution:
> > https://github.com/apache/sling/tree/trunk/karaf
> > 
> > Start Karaf and open http://localhost:8181/system/console/features,
> > install
> > sling-launchpad-oak-tar and sling-samples-fling by clicking the
> > play/install buttons on the right. Open http://localhost:8181/fling.html
> > 
> > O.
> > 
> >> Thanks - Andy Schaefer




Re: Fling Installation on Trunk

2017-03-28 Thread Andreas Schaefer Sr.
Hi Oliver

It would be nice if the Readme would indicate that this is a work in
progress to avoid users wasting time on a piece that is not ready
for prime time. As the trunk is probably the first thing people
get as Sling code this would be helpful I think.

In my opinion an example should be plug and play. For anyone
not very familiar with Sling this is disheartening and can turn them
away from Sling. I hope that Fling eventually gets there but for
now I pass as I don’t have the time to look into that (have my own
little peeve Sling project).

Thanks - Andy Schaefer

> On Mar 28, 2017, at 1:22 AM, Oliver Lietz  wrote:
> 
> On Monday 27 March 2017 13:05:38 Andreas Schaefer Sr. wrote:
>> Hi
>> 
>> I tried to install Fling from the Samples but failed with the latest Sling.
>> 
>> First I had to install Sling Messaging and Sling Query but then
>> I gave up on Sling Thymeleaf which has dependencies on
>> com.fasterxml.jackson.ocre etc that are not deployed in Sling and it also
>> looks like they are not deployed by any other bundle.
>> 
>> A sample does not much good if I cannot build and install it, right?
> 
> *sigh
> 
>> I am pretty fluent with package dependencies and so if I cannot
>> figure it out in an acceptable time frame then who will.
> 
> Stop whining and start reading, please.
> 
>> Any pointers on how to get this working would be very much
>> appreciated.
> 
> The version of Fling is 0.0.1-SNAPSHOT which clearly indicates that it is 
> work 
> in progress. Fling itself depends on some snapshots namely Validation and 
> Messaging (and therefore has to be adjusted sometimes when those dependencies 
> do incompatible changes – see my latest commits). Fling's prerequisites are 
> listed in the README: https://github.com/apache/sling/tree/trunk/samples/fling
> 
> How to install Scripting Thymeleaf is described in its README (and btw. 
> Jackson is optional):
> https://github.com/apache/sling/tree/trunk/contrib/scripting/org.apache.sling.scripting.thymeleaf
> 
> If you are unable to install those dependencies into Launchpad you can try 
> with Sling's Karaf Distribution: 
> https://github.com/apache/sling/tree/trunk/karaf
> 
> Start Karaf and open http://localhost:8181/system/console/features, install 
> sling-launchpad-oak-tar and sling-samples-fling by clicking the play/install 
> buttons on the right. Open http://localhost:8181/fling.html
> 
> O.
> 
>> Thanks - Andy Schaefer
> 



Re: Best Sling samples for a beginner to look at?

2017-03-28 Thread Chris Millar
Slick is very dense, but does showcase nearly everything you can do with
Sling (with zero additional bundles). Slingbucks is a good start and was
primarily what I used to learn Sling. It's based on ESP which can be a
little rough if you want to learn HTL.

If I were just starting out and wanting to learn Sling, I would…

1. Build some basic forms in plain old HTML using the Sling CRUD wiki page
[0] as your guide.

2. These forms should set properties, nested nodes, image uploads, etc.

3. Upload using WebDAV.

4. Login at [1]

5. Submit your forms.

6. Validate the results at [2]

7. Rinse and repeat.

8. Start building HTL pages that consume the properties you made via your
forms. This will be all about resourceTypes.

When you want to bump up to the next level, use the same CRUD guide, but
use the Java API combined with Sling’s excellent Eclipse Plugin / Project
builder [3].

For the next level, contribute to Slick. :-)

There’s probably a need for an “htlblog” now that HTL has matured and ships
with Sling 8 by default.

If you want to learn HTL head to the specification [4] which will be better
than any tutorial online (including my own).

[0]
https://sling.apache.org/documentation/the-sling-engine/sling-api-crud-support.html
[1] http://localhost:8080/
[2] http://localhost:8080/.explorer.html
[3] https://sling.apache.org/downloads.cgi#ide-tooling
[4]
https://github.com/Adobe-Marketing-Cloud/htl-spec/blob/master/SPECIFICATION.md


Re: Export content as JSON ready to be imported

2017-03-28 Thread Guillaume Lucazeau
Hello Bertrand,

Thank you for your reply. I have created SLING-6738 for the ACLs import.

Before adding unit tests and sending a PR, I would like to know if I'm
going in the right direction.

I've seen that in JsonReader there are already createAce and createAcl
methods, but they are used to create ACLs from the acl.json servlet.

So, I've modified the handleSecurity method, and if the node is named
"rep:policy", I call my own method "createAceFromPolicy". This method just
loops on the subnodes of a "rep:policy" node (i.e. keys starting with
"allow" or "deny", gather all information and calls
contentCreator.createAce.

It works fine for my case, but I would be curious to have some feedback and
make sure I didn't forget anything. At the beginning of the discussion
Robert was talking about editing the content importer, but I couldn't find
how I was suppose to do that.

Also, I would like to know if the order of the ACE is important. As there
is no order property on the JSON returned by the content servlet, and has
JSON is not ordered, I'm not able so far to keep the original order.

Thank you for your help,

Guillaume

2017-03-28 11:56 GMT+02:00 Bertrand Delacretaz :

> Hi,
>
> On Tue, Mar 28, 2017 at 11:25 AM, Guillaume Lucazeau
>  wrote:
> > ...Considering the lack of responses, Re-importing exported JSON,
> including
> > the priviliges, doesn't seem to be a feature that lots of people need,
> so I
> > will try to patch the importer on my own :)..
>
> I actually have a use case for this on my list, but that's a long list
> so I'm not sure when I'll start working on it.
>
> > ...I was wondering if pull requests on Github are the best way to submit
> > patches to Sling, or if you prefer diff files attached to a ticket...
>
> We need a jira ticket in any case, but submitting patches as pull
> requests works.
>
> Looking forward to your contributions!
>
> (and don't forget the tests ;-)
>
> -Bertrand
>


Re: Export content as JSON ready to be imported

2017-03-28 Thread Bertrand Delacretaz
Hi,

On Tue, Mar 28, 2017 at 11:25 AM, Guillaume Lucazeau
 wrote:
> ...Considering the lack of responses, Re-importing exported JSON, including
> the priviliges, doesn't seem to be a feature that lots of people need, so I
> will try to patch the importer on my own :)..

I actually have a use case for this on my list, but that's a long list
so I'm not sure when I'll start working on it.

> ...I was wondering if pull requests on Github are the best way to submit
> patches to Sling, or if you prefer diff files attached to a ticket...

We need a jira ticket in any case, but submitting patches as pull
requests works.

Looking forward to your contributions!

(and don't forget the tests ;-)

-Bertrand


Re: Export content as JSON ready to be imported

2017-03-28 Thread Guillaume Lucazeau
Hello,

So I've realized my previous question was dumb, ACLs always get returned
when you provide a depth to the JSON servlet...

Considering the lack of responses, Re-importing exported JSON, including
the priviliges, doesn't seem to be a feature that lots of people need, so I
will try to patch the importer on my own :)

I was wondering if pull requests on Github are the best way to submit
patches to Sling, or if you prefer diff files attached to a ticket.

Thank you,
Guillaume

2017-03-20 11:50 GMT+01:00 Guillaume Lucazeau :

> Hello,
>
> I realized that when getting some content as JSON from the basic servlet,
> I sometimes get the ACLs nodes. But this only happens in some environment,
> not on my local environment nor with a simple Sling standalone jar.
>
> Can you confirm that I shouldn't get ACLs nodes when getting content as
> JSON?
>
> Because that's why I asked how to handled those nodes during JSON import,
> but I may have been mistaken by an unusual situation.
>
> Thank you,
> Guillaume
>
> 2017-03-07 11:15 GMT+01:00 Guillaume Lucazeau :
>
>> Hello,
>>
>> I'm having troubles finding where I should handle ACLs nodes. In your
>> first e-mail you said
>> > Not sure about ACLs though, it seems like they should be handled by the
>> content importer.
>>
>> From what I see the content importer is the main entry point for content
>> import and is handling JSON or XML content, content that can contain actual
>> nodes and ACLs nodes. Therefore, I don't really understand how I could What
>> did you have in mind?
>> From my understanding, the DefaultContentCreator would have to be able to
>> create ACLs node and properties.
>>
>> Any advice or suggestion on how to implement ACLs imports would be really
>> helpful.
>>
>> Is that something already available in Adobe products built on top of
>> Sling?
>>
>> Thank you very much for your help.
>>
>> Best regards,
>> Guillaume
>>
>>
>> On Mon, Mar 6, 2017 at 5:39 PM, Guillaume Lucazeau 
>> wrote:
>>
>>> I have created this ticket, for protected properties and nodes:
>>> https://issues.apache.org/jira/browse/SLING-6614
>>>
>>> I have realized after my previous e-mail that autocreated properties
>>> would actually be there after node creation and that I could check their
>>> protected status. I have created this PR: https://github.com/apache/slin
>>> g/pull/201 if you want to have a look. It works with my content export,
>>> but I am not sure it covers all the cases.
>>>
>>> I will probably have more questions about ACLs and the content importer.
>>>
>>> Thank you,
>>> Guillaume
>>>
>>> On Mon, Mar 6, 2017 at 5:03 PM, Robert Munteanu 
>>> wrote:
>>>
 Hi Guillaume,

 On Mon, 2017-03-06 at 12:20 +0100, Guillaume Lucazeau wrote:
 > Hello Robert,
 >
 > I finally have time this week to work on those enhancements, required
 > on
 > our project. How does it work, should I create tickets in Sling Jira
 > and
 > put a comment saying that i'm trying to fix this?

 Yup, sounds like a good idea.

 >
 > I have a question regarding your previous answer: how will this work
 > for
 > new properties? For instance, if I want to import some JSON for new
 > nodes
 > containing a "jcr:created" property, those new nodes will not contain
 > any
 > property and therefore I won't be able to check if "jcr:created" is
 > protected or not, am I right?

 You should be able to get more information by accessing the node's
 primary/mixin node types and node definition.

 Robert

 >
 > I have started to look at the DefaultContentCreator class in the jcr
 > contentloader, but any help would be useful.
 >
 > Best regards,
 > Guillaume
 >
 > On Wed, Dec 21, 2016 at 1:08 PM, Robert Munteanu 
 > wrote:
 >
 > > On Wed, 2016-12-21 at 12:30 +0100, Guillaume Lucazeau wrote:
 > > > Hello Robert,
 > > >
 > > > Is it something that would be valuable to Sling itself, or should
 > > > I
 > > > try to
 > > > do it just for my project?
 > >
 > > Enhancements to the content loader are more than welcome in Sling
 > > :-)
 > >
 > > > I couldn't find a list of all protected properties in Jackrabbit,
 > > > do
 > > > you
 > > > know if there is one? Or maybe there is a way to dynamically know
 > > > if
 > > > a
 > > > property is protected
 > >
 > > javax.jcr.Node#getProperties() will get you a list of properties
 > > defined on a node, and then you can use
 > > javax.jcr.Property#getDefinition() to retrieve its definition.
 > > Finally,
 > >  javax.jcr.nodetype.PropertyDefinition#isProtected() will let you
 > > know
 > > if the property is protected.
 > >
 > > Robert
 > >
 > > >
 > > > Thank you
 > > >
 > > > Regards,
 > > > 

Re: Best Sling samples for a beginner to look at?

2017-03-28 Thread Bertrand Delacretaz
Hi Greg,

On Tue, Mar 28, 2017 at 6:21 AM, Greg Fullard  wrote:
> ...The only ones that have been touched in the last year are:
>  - Slingshot
>  - Slingbucks
>  - Fling (the one Andy mentioned) ...

I can really only speak about Slingbucks - that one is relevant and up
to date, it's a small thing but demonstrates important basic concepts.

-Bertrand


Re: Fling Installation on Trunk

2017-03-28 Thread Oliver Lietz
On Monday 27 March 2017 13:05:38 Andreas Schaefer Sr. wrote:
> Hi
> 
> I tried to install Fling from the Samples but failed with the latest Sling.
> 
> First I had to install Sling Messaging and Sling Query but then
> I gave up on Sling Thymeleaf which has dependencies on
> com.fasterxml.jackson.ocre etc that are not deployed in Sling and it also
> looks like they are not deployed by any other bundle.
> 
> A sample does not much good if I cannot build and install it, right?

*sigh

> I am pretty fluent with package dependencies and so if I cannot
> figure it out in an acceptable time frame then who will.

Stop whining and start reading, please.

> Any pointers on how to get this working would be very much
> appreciated.

The version of Fling is 0.0.1-SNAPSHOT which clearly indicates that it is work 
in progress. Fling itself depends on some snapshots namely Validation and 
Messaging (and therefore has to be adjusted sometimes when those dependencies 
do incompatible changes – see my latest commits). Fling's prerequisites are 
listed in the README: https://github.com/apache/sling/tree/trunk/samples/fling

How to install Scripting Thymeleaf is described in its README (and btw. 
Jackson is optional):
https://github.com/apache/sling/tree/trunk/contrib/scripting/org.apache.sling.scripting.thymeleaf

If you are unable to install those dependencies into Launchpad you can try 
with Sling's Karaf Distribution: 
https://github.com/apache/sling/tree/trunk/karaf

Start Karaf and open http://localhost:8181/system/console/features, install 
sling-launchpad-oak-tar and sling-samples-fling by clicking the play/install 
buttons on the right. Open http://localhost:8181/fling.html

O.

> Thanks - Andy Schaefer