Re: How to Execute a Sling Replication

2017-07-25 Thread Andreas Schaefer Sr.
Hi Timothee

I am slowly getting there. As much as I love OSGi for its extensibility as much
I hate it when it goes wrong.

Turns out for the Forward Distribution Agent I need a Distribution Package 
Builder
which is not configured in the Sample but I could also not find it in the IT 
tests.

After having a closer at the IT tests I figured out that I also need to set the
run mode ‘notshared’.

This did the trick and now I have the author configuration up and running.

I let you know if I run into other issues.

Thanks - Andy

> On Jul 25, 2017, at 7:22 AM, Timothee Maret <tma...@apache.org> wrote:
> 
> Hi Andy,
> 
> Indeed, I am referring to the curl command you shared.
> 
> Regarding the unsupported operation exception, I think you are on the right
> track when thinking that the agent is not started.
> An agent configuration refers to set of services. The agent is only started
> if all the referenced services are available.
> The likely reason for your agent not to be started, is that one or more
> references are not satisfied.
> 
> In order to figure out what reference may be unsatisfied, you may want to
> look at the agent component you are configuring in the OSGI components
> console (path is /system/console/components). The references marked as
> "Unsatisfied" must be resolved, typically by adding a configuration for the
> missing referenced service.
> 
> HTH,
> 
> Timothee
> 
> 2017-07-24 21:32 GMT+02:00 Andreas Schaefer Sr. <schaef...@me.com>:
> 
>> Hi Timothee
>> 
>> Thanks for the quick reply. If you are referring to:
>> 
>> curl -v -u admin:admin http://localhost:8080/libs/
>> sling/distribution/services/agents/publish -d 'action=ADD' -d
>> 'path=/content/sample1’
>> 
>> then it does not work on my installation. I get a ‘Unsupported Operation
>> Exception: create’ which
>> I think happens because the call to the agent is ignored. One thing I
>> noticed is that this node
>> in Composum is never resolved (spinner keeps on spinning).
>> 
>> With the investigation into the Default Distribution Component Provider is
>> will also check out
>> this as I think they are related.
>> 
>> - Andy
>> 
>>> On Jul 24, 2017, at 11:13 AM, Timothee Maret <tma...@apache.org> wrote:
>>> 
>>> Hi Andreas,
>>> 
>>> The documentation could indeed be improved in this area.
>>> 
>>> I think your use case matches forward distribution. You could look at the
>>> curl commands in
>>> 
>>> 
>>> https://github.com/apache/sling/tree/trunk/contrib/
>> extensions/distribution#forward-distribution
>>> 
>>> Regards,
>>> 
>>> Timothee
>>> 
>>> 2017-07-24 16:46 GMT+02:00 Andreas Schaefer Sr. <schaef...@me.com>:
>>> 
>>>> Hi
>>>> 
>>>> I managed to build and install the Sling Distribution including
>>>> the sample package. Everything looks fine but I am not sure
>>>> how to start a replication of a given node.
>>>> 
>>>> I want to replicate a given node on the Author to the Publish
>>>> instance(s) defined in the used agent. How would I do that
>>>> from the command line?
>>>> 
>>>> Thanks - Andy Schaefer
>>>> 
>> 
>> 



Re: How to Execute a Sling Replication

2017-07-24 Thread Andreas Schaefer Sr.
Hi Timothee

Thanks for the quick reply. If you are referring to:

curl -v -u admin:admin 
http://localhost:8080/libs/sling/distribution/services/agents/publish -d 
'action=ADD' -d 'path=/content/sample1’

then it does not work on my installation. I get a ‘Unsupported Operation 
Exception: create’ which
I think happens because the call to the agent is ignored. One thing I noticed 
is that this node
in Composum is never resolved (spinner keeps on spinning).

With the investigation into the Default Distribution Component Provider is will 
also check out
this as I think they are related.

- Andy

> On Jul 24, 2017, at 11:13 AM, Timothee Maret <tma...@apache.org> wrote:
> 
> Hi Andreas,
> 
> The documentation could indeed be improved in this area.
> 
> I think your use case matches forward distribution. You could look at the
> curl commands in
> 
> 
> https://github.com/apache/sling/tree/trunk/contrib/extensions/distribution#forward-distribution
> 
> Regards,
> 
> Timothee
> 
> 2017-07-24 16:46 GMT+02:00 Andreas Schaefer Sr. <schaef...@me.com>:
> 
>> Hi
>> 
>> I managed to build and install the Sling Distribution including
>> the sample package. Everything looks fine but I am not sure
>> how to start a replication of a given node.
>> 
>> I want to replicate a given node on the Author to the Publish
>> instance(s) defined in the used agent. How would I do that
>> from the command line?
>> 
>> Thanks - Andy Schaefer
>> 



How to Execute a Sling Replication

2017-07-24 Thread Andreas Schaefer Sr.
Hi

I managed to build and install the Sling Distribution including
the sample package. Everything looks fine but I am not sure
how to start a replication of a given node.

I want to replicate a given node on the Author to the Publish
instance(s) defined in the used agent. How would I do that
from the command line?

Thanks - Andy Schaefer


Re: Service user for sling pipes

2017-05-17 Thread Andreas Schaefer Sr.
I use a Service User and packaged it up in a Content Package which deploys just 
fine.

The only drawback is that if you need to set permissions with it then you might 
end up
with an issue where the user is created after the policies are created which 
leads to
the policies not being set (no user there).

I think the best solution is to provide a package that contains the service 
user and
service user mapping and ask the deploy to install it first.

To create the service user package I just created the Service User manually with
Composum, created a package, downloaded and integrated into my project.

- Andy

> On May 17, 2017, at 12:29 AM, Nicolas Peltier  
> wrote:
> 
> Thanks Robert! will go without service user for now, and track a bug around 
> it.
> 
>> On 17 May 2017, at 09:00, Robert Munteanu  wrote:
>> 
>> Hi Nicolas,
>> 
>> On Tue, 2017-05-16 at 19:18 +, Nicolas Peltier wrote:
>>> Hey, 
>>> 
>>> I’d need for a JIRA (asynchronous execution of sling pipes) to create
>>> a service user. 
>>> Not sure how I should bundle that. I see some stuff in the
>>> launchpad’s repoinit scripts, but obviously that’s not a place for
>>> extensions…
>> 
>> Service users, as you pointed out, are created via the repoinit
>> provisioning model files. If you want to use a service user, just use
>> loginService in your code and leave the service user mapping to the
>> deployer.
>> 
>> The slingshot sample shows a way in which you can include a
>> provisioning model file with a bundle, but IMO this only suitable for
>> samples and demos, as it cuts down on flexibility.
>> 
>> Robert
> 



Re: Securing a Servlet w/o Resource

2017-04-11 Thread Andreas Schaefer Sr.
Yeah, that might be a good idea.

That said I ran into an issue with JCR Package and Groups.

Having a group part of the package will replace the group
node during installation even when filter mode is set to update
or merge.

This is an issue because User Group Membership is stored on
the group and a redeployment will wipe that.

Is that by design?

Thanks - Andy Schaefer

> On Apr 11, 2017, at 12:27 AM, Bertrand Delacretaz <bdelacre...@apache.org> 
> wrote:
> 
> Hi,
> 
> On Mon, Apr 10, 2017 at 10:15 PM, Andreas Schaefer Sr. <schaef...@me.com> 
> wrote:
>> ...If I have a servlet that is not based on a resource how would
>> I secure access in Sling?..
> 
> IIUC in your code you check for membership in a specific group - that
> would probably work but it might be more flexible and manageable to
> check that the current user has access to a specific "permissions
> shadow" resource.
> 
> You could have a /permissions resource with specific children for
> various operations like /permissions/send-email-to-example_com, and
> have your servlet check read access to those based on operations
> names.
> 
> -Bertrand



Securing a Servlet w/o Resource

2017-04-10 Thread Andreas Schaefer Sr.
Hi

If I have a servlet that is not based on a resource how would
I secure access in Sling?

This is what I came up with on doPost():

userManager = AccessControlUtil.getUserManager(session);
Authorizable authorizable = 
userManager.getAuthorizable(request.getUserPrincipal());
if(authorizable == null) {
// handle anonymous user
return;
}
boolean ok = false;
if("admin".equals(authorizable.getID())) {
ok = true;
} else {
Iterator i = authorizable.declaredMemberOf();
while(i.hasNext()) {
Group group = i.next();
if("sling-node".equals(group.getID())) {
ok = true;
break;
}
}
}
if(!ok) {
// Handle wrong permissions
return;
}

Re: Different ways to define initial content :: Content.xml vs Json equivalent

2017-04-04 Thread Andreas Schaefer Sr.
Yes, I was thinking that might be the issue.

Do you guess have already something on Git?

Thanks - Andy Schaefer

> On Apr 4, 2017, at 12:13 AM, Robert Munteanu  wrote:
> 
> On Tue, 2017-04-04 at 08:32 +0200, Roy Teeuwen wrote:
>> Hey Andy,
>> 
>> The license inside might not be good enough ;)
>> 
>> Greets,
>> Roy
>>> On 3 Apr 2017, at 22:50, Andreas Schaefer 
>>> wrote:
>>> 
>>> Why is that necessary? The one from Adobe isn't good enough?
> 
> IANAL and speaking only as an Apache committer, not as an Adobe
> employee.
> 
> That being said, that artifact is not present on Maven central, and on
> repo.adobe.com the following disclaimer is used
> 
>This maven2 repository provides access to public artifacts used in
>conjunction with developing java-based applications on Adobe
>frameworks. Adobe Terms apply.
> 
> Adobe terms links to http://www.adobe.com/misc/terms.html .
> 
> I for one would not use that plugin in Apache Sling applications
> without legal advice, but a brief look tells me that these are not
> intended for use with non-Adobe apps.
> 
> Robert
> 
>>> 
>>> - Andy Schaefer
>>> 
 On Apr 3, 2017, at 3:23 AM, Robert Munteanu 
 wrote:
 
 Hi Greg,
 
> On Sat, 2017-04-01 at 13:18 +0200, Greg Fullard wrote:
> Hi All
> 
> I see that there is some difference between how content
> projects are
> handled between the Sling IDE tools and the Maven archetypes.
> 
> 
>   1. The "Sling Content Project" wizard creates a project with
> a
> jcr_root
>   folder which then contains folders and content.xml files.
> This is
> very
>   similar to what I'm used to with AEM Archetype 10.
 
 In addition to what others have said, there is plan ( with no
 time
 commitment ) to add our own content-package Maven plugin, which
 would
 make this kind of project usable with Maven.
 
 https://issues.apache.org/jira/browse/SLING-6081
 
 Robert
 
>   2. The sling-initial-content-archetype, on the other hand,
> generates a
>   SLING-INF folder with an XML node descriptor file (as
> explained at
>   http://sling.apache.org/documentation/bundles/content-loading
> -jcr-
> contentloader.html
>   )
>   3. The Slingbucks example uses JSON descriptor files.
> 
> 
> Obviously all these methods work, but I'm interested to get an
> idea
> of what
> the recommended method is. Perhaps based on specific criteria
> of my
> project?
> 
> Much appreciated
> 
> Greg
> 
>> 
>> 
> 



Re: Different ways to define initial content :: Content.xml vs Json equivalent

2017-04-01 Thread Andreas Schaefer Sr.
Hi Greg

One difference between an JCR Content Package (ZIP file) is that you can use
the exploded tree inside the Eclipse or IntelliJ plugin and edit / deploy / 
import (from
server) one file at a time. With the Bundle Content you have to deploy it
as an entire bundle.

If working with JSon you have to keep in mind that:

1) You don’t have comments but you can add a comment attribute but
see that as JCR property

2) There is only a SINGLE LINE text in JSon

This works:

“attributeOne” : “One line is ok”

This does not:

“attributeTwo” : “This line will
  fail as it is multi line”

For most part this is ok but certain configurations that is not good.

Having worked on bigger AEM projects we ended up having many
JCR Content Packages and OSGi Bundles and so eventually we
used a dedicated ALL JCR Package which is just there to bundle up
all artifacts and deploy them in one swoop.

For most part I prefer the Bundle Contents over JCR Packages especially
with Sling as Composum prints outs node properties as JSon. That said
I never worked on a big project with it and so I don’t know what issues
I would face. A friend of mine said they ran into issues with it.

As far as I know SLING-INF is not needed but I would recommend to
place your content is a specially marked folder and not just 
/scr/main/resources.

This line is more instructive:


SLING-INF/libs/sling/validation/i18n;overwrite:=true;path:=/libs/sling/validation/i18n

than this:

apps/fling;path:=/apps/fling;overwrite:=true;uninstall:=true

In Sling 9 you can have both JCR Packages and Bundle Content w/o any issues.

Cheers - Andy

> On Apr 1, 2017, at 4:18 AM, Greg Fullard  wrote:
> 
> Hi All
> 
> I see that there is some difference between how content projects are
> handled between the Sling IDE tools and the Maven archetypes.
> 
> 
>   1. The "Sling Content Project" wizard creates a project with a jcr_root
>   folder which then contains folders and content.xml files. This is very
>   similar to what I'm used to with AEM Archetype 10.
>   2. The sling-initial-content-archetype, on the other hand, generates a
>   SLING-INF folder with an XML node descriptor file (as explained at
>   
> http://sling.apache.org/documentation/bundles/content-loading-jcr-contentloader.html
>   )
>   3. The Slingbucks example uses JSON descriptor files.
> 
> 
> Obviously all these methods work, but I'm interested to get an idea of what
> the recommended method is. Perhaps based on specific criteria of my
> project?
> 
> Much appreciated
> 
> Greg
> 
> -- 
> 
> 
> --
> *Unlock Interaction*
> CIC = Correspondence, Interactions & Communications
> 
> 
> *8 BIT PLATOON disclaimer*
> This e-mail transmission contains confidential information, which is the 
> property of EOH Holdings Limited and its subsidiaries (“EOH”). No person, 
> other than the recipient (so indicated by the sender) may use or disclose 
> the contents of this message, links or attachments hereto, to any person 
> whatsoever. Unauthorised disclosure and/or use may result in civil and 
> criminal liability.
> Any views expressed in this message are those of the individual sender, 
> except where the message states otherwise and the sender is authorised to 
> state them to be the views of any such entity.
> The disclaimer forms part of the content of this e-mail in terms of section 
> 11 of the Electronic Communications and Transactions Act, 25 of 2002. Refer 
> to http://www.eoh.co.za/disclaimer 
> --
> 
> 



Re: Fling Installation on Trunk

2017-03-31 Thread Andreas Schaefer Sr.
For something else I delved into Sling Provisioning and I
came up with a way to import Thymeleaf. Not sure if  that
is the best way but it seems to work.

When I add a file called thymeleaf.txt to 
launchpad/builder/src/main/provisioning
with that content:

[feature name=thymeleaf]

# Add the dependencies on the Model exporter
[artifacts]
org.attoparser/attoparser/2.0.2.RELEASE
org.unbescape/unbescape/1.1.4.RELEASE
org.apache.servicemix.bundles/org.apache.servicemix.bundles.ognl/3.2_1
org.javassist/javassist/3.20.0-GA
org.apache.sling/org.apache.sling.scripting.thymeleaf/1.1.1-SNAPSHOT

Build and start sling (just the builder) I have thymeleaf installed and prepped
and ready.

So I am wondering if there is a better way or if I can create my own 
provisioning
models but keep them in a separate folder.

Thanks - Andy Schaefer

> On Mar 28, 2017, at 1:22 AM, Oliver Lietz <apa...@oliverlietz.de> 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: Use of global HTL object log

2017-03-31 Thread Andreas Schaefer Sr.
Hi Burkhard

Thanks for the tip. After tinkering around with REPL I finally got it working 
with
this,

The page logging:

${logError.logMe}

The logic.js containing the method:

use(function () {
var text = this.text || ' Not Found';
return {
logMe: function() {
log.error(text);
}
};
});

Here with a single parameter:

${logError.logMe}

use(function () {
var text = this.text || ' Not Found';
var param1 = this.parameter1;
return {
message: 'hello world',
logMe: function() {
log.error(text, param1);
}
};
});

Not quite user-friendly but it gets the job done.

Thanks - Andy

> On Mar 30, 2017, at 12:07 AM, Burkhard Pauli <m...@bpauli.de> wrote:
> 
> Hi Andy,
> 
> The access to the global logger is added via the SlingBindings.
> 
> You can get it within the Java Use-API [0] with:
> Logger logger = get(SlingBindings.LOG, Logger.class);
> (But it's more common to define your own logger inside of your Java Use
> Object.)
> 
> or in the JavaScript Use-API[1] just with the global variable 'log'.
> 
> Cheers,
> Burkhard
> 
> [0] https://docs.adobe.com/docs/en/htl/docs/use-api/java.html
> [1] https://docs.adobe.com/docs/en/htl/docs/use-api/javascript.html
> 
> On Wed, Mar 29, 2017 at 8:57 PM, Andreas Schaefer Sr. <schaef...@me.com>
> wrote:
> 
>> Hi
>> 
>> In the HTL documentation I saw that there is a global
>> HTL object log for the SLF4J logger.
>> 
>> How would I use that logger?
>> 
>> Cheers - Andy
>> 
> 
> 
> 
> -- 
> ––
> Burkhard Pauli
> Bötzowstr. 13 | 10407 Berlin
> Fon 030. 648 315 73 | Mobil 0151 407 033 89
> –-



Use of global HTL object log

2017-03-29 Thread Andreas Schaefer Sr.
Hi

In the HTL documentation I saw that there is a global
HTL object log for the SLF4J logger.

How would I use that logger?

Cheers - Andy


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 <apa...@oliverlietz.de> 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: Sling Resource Rendering Inheritance

2017-03-23 Thread Andreas Schaefer Sr.
Hi Roy

Thanks for all your help.

At the end it turns out that I made a mistake when using the HTL include:

This was my first include:



which fails. But using this:



does work.

So on another node I saw some Sling apps (samples and Composum) that place
their components under /libs instead of /apps.

In AEM developers were told not to put anything under /libs and now Sling it 
going
the other way. Is there a reason for this shift. As far as I know there’s no 
difference.

Thanks for all your help - Andy

> On Mar 23, 2017, at 12:30 AM, Roy Teeuwen <r...@teeuwen.be> wrote:
> 
> Hey Andreas,
> 
> I am not sure why it is not working for you that way, but that should 
> definitely still work, there is no dependency whatsoever to a folder being 
> named "components", see my next examples:
> 
> page-example-2.zip: I moved everything right under /apps/idoneus, no 
> /components => still works
> page-example-3.zip: I moved everything to under /libs/idoneus => still works
> 
> https://www.dropbox.com/s/3d64tqd62wb81n9/page-example-2.zip?dl=1 
> <https://www.dropbox.com/s/3d64tqd62wb81n9/page-example-2.zip?dl=1>
> https://www.dropbox.com/s/tw0edw4dddi9ksh/page-example-3.zip?dl=1 
> <https://www.dropbox.com/s/tw0edw4dddi9ksh/page-example-3.zip?dl=1>
> 
> Greets,
> Roy
> 
>> On 22 Mar 2017, at 19:48, Andreas Schaefer Sr. <schaef...@me.com 
>> <mailto:schaef...@me.com>> wrote:
>> 
>> Yeah, the have a big “Download Now” button and that is not the file.
>> I think the reason was that I use Safari w/o Flash and then the link won’t 
>> show.
>> 
>> That said your code words and the major difference I saw is that the 
>> inheritance
>> only works if it is in the /apps//components folder. I 
>> tried
>> that after I got mine working by copying the working resource type 
>> definitions back
>> up to /apps/.
>> 
>> This structure works:
>> 
>> /apps
>>  /testApps
>>  /components
>>  /home
>>  body.html
>>  /page
>>  body.html
>>  page.html
>> 
>> The page.html has a HTL import of body.html and it will take the one from 
>> actual
>> resource type (here testApps/components/home).
>> 
>> Can anyone from the sling team verify that? If so why, where is that defined 
>> and
>> is that configurable?
>> 
>> I used the sling sample Fling as an example but that does not use 
>> inheritance.
>> 
>> Thanks for you swift help - Andy Schaefer
>> 
>>> On Mar 22, 2017, at 11:05 AM, Roy Teeuwen <r...@teeuwen.be 
>>> <mailto:r...@teeuwen.be>> wrote:
>>> 
>>> Hey Andreas,
>>> 
>>> Huh, I think you pushed the advertisement button or something, or maybe you 
>>> have to click twice. Anyway, here, my dropbox:
>>> 
>>> https://www.dropbox.com/s/0sem7twkr5a2icp/page-example-1.zip?dl=1 
>>> <https://www.dropbox.com/s/0sem7twkr5a2icp/page-example-1.zip?dl=1>
>>> 
>>> Greetings,
>>> Roy
>>>> On 22 Mar 2017, at 18:26, Andreas Schaefer <a...@headwire.com> wrote:
>>>> 
>>>> Hi Roy
>>>> 
>>>> I tried to download your example but I am not going to install
>>>> an Installer software just to see a ZIP file.
>>>> 
>>>> Can you share this file by any other means?
>>>> 
>>>> Thanks - Andy Schaefer
>>>> 
>>>>> On Mar 21, 2017, at 9:52 PM, Roy Teeuwen <r...@teeuwen.be> wrote:
>>>>> 
>>>>> Hey Andreas,
>>>>> 
>>>>> I made an example package in sling-9, you can use composum to install the 
>>>>> package.
>>>>> 
>>>>> http://www12.zippyshare.com/v/nWrL1Azm/file.html
>>>>> 
>>>>> It works for me, I made the following:
>>>>> 
>>>>> /apps/idoneus/components/page => contains page.html and header.html which 
>>>>> does a data-sly-include of header.html
>>>>> /apps/idoneus/components/home => supertype is page, and overwrites the 
>>>>> header.html
>>>>> /content/idoneus/en => is a homepage, you can see that the header now 
>>>>> says "Header home page"
>>>>> /content/indoneus/en/test-page => is a normal page, has as header "Header 
>>>>> base page"
>>>>> 
>>>>> Can you ver

Re: Sling Resource Rendering Inheritance

2017-03-22 Thread Andreas Schaefer Sr.
Yeah, the have a big “Download Now” button and that is not the file.
I think the reason was that I use Safari w/o Flash and then the link won’t show.

That said your code words and the major difference I saw is that the inheritance
only works if it is in the /apps//components folder. I 
tried
that after I got mine working by copying the working resource type definitions 
back
up to /apps/.

This structure works:

/apps
/testApps
/components
/home
body.html
/page
body.html
page.html

The page.html has a HTL import of body.html and it will take the one from actual
resource type (here testApps/components/home).

Can anyone from the sling team verify that? If so why, where is that defined and
is that configurable?

I used the sling sample Fling as an example but that does not use inheritance.

Thanks for you swift help - Andy Schaefer

> On Mar 22, 2017, at 11:05 AM, Roy Teeuwen  wrote:
> 
> Hey Andreas,
> 
> Huh, I think you pushed the advertisement button or something, or maybe you 
> have to click twice. Anyway, here, my dropbox:
> 
> https://www.dropbox.com/s/0sem7twkr5a2icp/page-example-1.zip?dl=1
> 
> Greetings,
> Roy
>> On 22 Mar 2017, at 18:26, Andreas Schaefer  wrote:
>> 
>> Hi Roy
>> 
>> I tried to download your example but I am not going to install
>> an Installer software just to see a ZIP file.
>> 
>> Can you share this file by any other means?
>> 
>> Thanks - Andy Schaefer
>> 
>>> On Mar 21, 2017, at 9:52 PM, Roy Teeuwen  wrote:
>>> 
>>> Hey Andreas,
>>> 
>>> I made an example package in sling-9, you can use composum to install the 
>>> package.
>>> 
>>> http://www12.zippyshare.com/v/nWrL1Azm/file.html
>>> 
>>> It works for me, I made the following:
>>> 
>>> /apps/idoneus/components/page => contains page.html and header.html which 
>>> does a data-sly-include of header.html
>>> /apps/idoneus/components/home => supertype is page, and overwrites the 
>>> header.html
>>> /content/idoneus/en => is a homepage, you can see that the header now says 
>>> "Header home page"
>>> /content/indoneus/en/test-page => is a normal page, has as header "Header 
>>> base page"
>>> 
>>> Can you verify the package and maybe share what is different, so that it 
>>> also gets typed textual on the mailing list for future reference
>>> 
>>> Greets,
>>> Roy
>>> 
>>> 
>>> 
 On 21 Mar 2017, at 20:18, Andreas Schaefer  wrote:
 
 Hi
 
 As a long time CQ / AEM backend developer I ran into some issues
 to adjust to Sling.
 
 I have a resource ‘Home Page’ that should render a JCR node as
 a HTML page. The Home page component then only adjust
 the layout of the Body and Head and the rest should be inherited from
 its Resource Super Type “Page’. I tried that but it does not render
 without the home.html as well as the footer missing in Home is not
 picked up.
 
 This is my configuration:
 
 1. JCR Content Node (/content/sample/home)
 
 
 http://www.jcp.org/jcr/1.0 
 " xmlns:nt="http://www.jcp.org/jcr/nt/1.0 
 " 
 xmlns:sling="http://sling.apache.org/jcr/sling/1.0 
 "
  jcr:primaryType="nt:unstructured"
  jcr:title="Sample Home"
  jcr:description="Sample Home Page"
  sling:resourceType="sample/home"
  sling:resourceSuperType="sample"
 />
 
 2. Home Page configuration (/apps/sample/home):
 
 
 http://www.jcp.org/jcr/1.0 
 " xmlns:nt="http://www.jcp.org/jcr/nt/1.0 
 " 
 xmlns:sling="http://sling.apache.org/jcr/sling/1.0 
 "
  jcr:primaryType="sling:Folder"
  jcr:title="Sample Home Page Component"
  jcr:description="Sample Home Page Component woth HTL"
  sling:resourceSuperType="sample/page"
 />
 
 This only contains the head.html and body.html file.
 
 3. Page Configuration (/apps/sample/page):
 
 
 http://www.jcp.org/jcr/1.0 
 " xmlns:nt="http://www.jcp.org/jcr/nt/1.0 
 " 
 xmlns:sling="http://sling.apache.org/jcr/sling/1.0 
 "
  jcr:primaryType="sling:Folder"
  jcr:title="Sample Page Component"
  jcr:description="Sample Page Component"
 />
 
 This contains the page.html which includes the head, body and footer.html 
 file.
 
 This setup does not work and I could only make it work by providing the 
 /apps/sample/home/home.html.
 
 Any way to make the work like in AEM?
 
 I am pretty sure 

Sling Resource Rendering Inheritance

2017-03-21 Thread Andreas Schaefer Sr.
Hi

As a long time CQ / AEM backend developer I ran into some issues
to adjust to Sling.

I have a resource ‘Home Page’ that should render a JCR node as
a HTML page. The Home page component then only adjust
the layout of the Body and Head and the rest should be inherited from
its Resource Super Type “Page’. I tried that but it does not render
without the home.html as well as the footer missing in Home is not
picked up.

This is my configuration:

1. JCR Content Node (/content/sample/home)


http://www.jcp.org/jcr/1.0 " 
xmlns:nt="http://www.jcp.org/jcr/nt/1.0 " 
xmlns:sling="http://sling.apache.org/jcr/sling/1.0 
"
 jcr:primaryType="nt:unstructured"
 jcr:title="Sample Home"
 jcr:description="Sample Home Page"
 sling:resourceType="sample/home"
 sling:resourceSuperType="sample"
/>

2. Home Page configuration (/apps/sample/home):


http://www.jcp.org/jcr/1.0 " 
xmlns:nt="http://www.jcp.org/jcr/nt/1.0 " 
xmlns:sling="http://sling.apache.org/jcr/sling/1.0 
"
 jcr:primaryType="sling:Folder"
 jcr:title="Sample Home Page Component"
 jcr:description="Sample Home Page Component woth HTL"
 sling:resourceSuperType="sample/page"
/>

This only contains the head.html and body.html file.

3. Page Configuration (/apps/sample/page):


http://www.jcp.org/jcr/1.0 " 
xmlns:nt="http://www.jcp.org/jcr/nt/1.0 " 
xmlns:sling="http://sling.apache.org/jcr/sling/1.0 
"
 jcr:primaryType="sling:Folder"
 jcr:title="Sample Page Component"
 jcr:description="Sample Page Component"
/>

This contains the page.html which includes the head, body and footer.html file.

This setup does not work and I could only make it work by providing the 
/apps/sample/home/home.html.

Any way to make the work like in AEM?

I am pretty sure that I don’t see the forest because of the trees here
but I could not figure out how to do it right even when looking at the
Sling Samples.

Thanks - Andy Schaefer

Re: How to create Rest APIs for non-JCR data in Sling 8??

2017-01-27 Thread Andreas Schaefer Sr.
I never develop for Sling but a few years doing backend on AEM.

So I am wondering if you used the Sling IDE Tooling (Eclipse or our IntelliJ 
Plugin)
and debugged your code there.

Did you try to use a Servlet that is bound to a Type instead of a Path? This
might do what you want.

Cheers - Andy

> On Jan 27, 2017, at 2:29 PM, lancedolan  wrote:
> 
> These APIs I'm looking to build are likely to use other OSGI services I've
> written, and perhaps even write to the JCR for other reasons. Imagine doing
> a GET /api/images/my-new-image.jpg and the image lives in Amazon S3, but you
> want to write some audit data into the JCR.
> 
> I'm still thinking through the overall solution, and have considered you're
> suggestion, but I don't want to give up on building APIs inside of
> OSGI/Sling unless I really need to.
> 
> 
> 
> --
> View this message in context: 
> http://apache-sling.73963.n3.nabble.com/How-to-create-Rest-APIs-for-non-JCR-data-in-Sling-8-tp4069947p4069949.html
> Sent from the Sling - Users mailing list archive at Nabble.com.



Re: Multiple Version of Commons Lang in OSGI...

2017-01-09 Thread Andreas Schaefer Sr.
I use Commons tools both version 2 and 3 together in AEM and so it should work.

That said how are you installing Commons lang and which package does need it.

If you have a custom package that needs commons lang 3 then you need to package 
it with it
if it is not provided from another package.

This is all OSGi behavior but this should be resolvable within.

Cheers - Andy

> On Jan 9, 2017, at 11:35 AM, lancedolan  wrote:
> 
> I have packages (such as composum tools) that depend on apache commons lang
> 3.
> 
> I have other packages (such as most of the sling itself) that depend on
> commons lang version 2.
> 
> There are no Java Package namespacing collisions between these packages -
> they can both exist in the same JVM safely. Version 3 uses
> "org.apache.commons.lang3.*" package. I should be able to install both of
> these packages.
> 
> However, possibly because they have the same artifact ID or something,
> installing version 3 overwrites version 2, meaning I can't have both, and
> thus can't run both the core sling packages and the composum tools. This is
> a deal breaker right now for my Sling P.O.C. project.
> 
> To be clear, the actual commons lang jar version 2 jar file, which is stored
> at /sling/felix/bundle71/version0.0, is deleted and and the version 3 jar
> file is stored at /sling/felix/bundle71/version0.1.
> 
> The only solution I can imagine is to modify the commons-lang bundle with a
> custom artifact ID so that Sling won't consider them the same artifact. That
> would be a hack and cause issues later on.
> 
> I'm positive somebody else has solved this issue? Google search yields
> nothing.
> 
> 
> 
> --
> View this message in context: 
> http://apache-sling.73963.n3.nabble.com/Multiple-Version-of-Commons-Lang-in-OSGI-tp4069450.html
> Sent from the Sling - Users mailing list archive at Nabble.com.



Dynamic Resource Change Listener

2016-12-25 Thread Andreas Schaefer Sr.
Hi

I would like to listen to JCR Nodes being added, modified and removed in Sling 
and saw that you provide the Resource Change Listener which would work 
perfectly but I could not figure out how to make the paths to listen for 
dynamic.

What I would love to have is to configure an OSGi Service that either 
implements ResourceChangeListener or does register one with Sling. The paths to 
listen for are set by the OSGi Configuration and the user can add, change or 
remove paths.

Is there a way to create a Resource Change Listener(s) dynamically so that when 
I receive the configuration (changes) I can register them rather when the 
Resource Change Listener service is deployed?

Thanks - Andy Schaefer