Re: Read Sling resources remotely

2013-08-22 Thread Dishara Wijewardana
Hi all,
I have created the JIRA [1] and attached the Apache Bench Mark results as
requested. All the reports and graphs attached to JIRA. I did it in 2
modes.
- All tests based on single server startup.
- Each test based on a fresh server startup.

[1] - https://issues.apache.org/jira/browse/SLING-3026


On Wed, Aug 14, 2013 at 2:25 PM, Bertrand Delacretaz  wrote:

> On Wed, Aug 14, 2013 at 10:53 AM, Ian Boston  wrote:
> > ...Before you start on the next phase I would like to see some stats,
> > even if they are only rudimentary
>
> Would be good IMO to collect these stats in a jira issue, so that we
> can keep track of the evolution.
>
> -Bertrand
>



-- 
Thanks
/Dishara


[jira] [Updated] (SLING-3026) Cassandra Resource Provider READ Latency Stats

2013-08-22 Thread Dishara Wijewardana (JIRA)

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

Dishara Wijewardana updated SLING-3026:
---

Attachment: SLING_CASSANDRA_LATENCY_STATS_TWO_CHART_22-08-2013.png
SLING_CASSANDRA_LATENCY_STATS_CHART_22-08-2013.png

The corresponding graphs attach herewith. 

> Cassandra Resource Provider READ Latency Stats 
> ---
>
> Key: SLING-3026
> URL: https://issues.apache.org/jira/browse/SLING-3026
> Project: Sling
>  Issue Type: Task
>Reporter: Dishara Wijewardana
>Priority: Critical
> Attachments: SLING_CASSANDRA_LATENCY_STATS_22-08-2013.txt, 
> SLING_CASSANDRA_LATENCY_STATS_CHART_22-08-2013.png, 
> SLING_CASSANDRA_LATENCY_STATS_TWO_CHART_22-08-2013.png
>
>
> This is to keep track on the statistics of the latency for the requests done 
> on Cassandra layer through Cassandra Resource Provider. Here we use Apache 
> Benchmark. 
> We have a test profile java component in the cassandra module to add bulk 
> test data to cassandra. 
> /content/cassandra/A/0   to /content/cassandra/A/999
> /content/cassandra/B/0   to /content/cassandra/B/
> /content/cassandra/C/0   to /content/cassandra/C/9
> /content/cassandra/D/0   to /content/cassandra/D/99
> And then this JIRA will keep track of reports on the http request time to 
> retrieve 1 node from each following data collection.
>   

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Comment Edited] (SLING-3026) Cassandra Resource Provider READ Latency Stats

2013-08-22 Thread Dishara Wijewardana (JIRA)

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

Dishara Wijewardana edited comment on SLING-3026 at 8/23/13 2:23 AM:
-

First round of report in brief: P.S This results based on very first time 
retrieval of these nodes (with in a single server startup). 

1. http://localhost:8080/content/cassandra/A/100.json - Time per request: 
65.449 [ms] 
2. http://localhost:8080/content/cassandra/B/100.json - Time per request: 
73.022 [ms]
3. http://localhost:8080/content/cassandra/C/100.json - Time per request: 
61.696 [ms]
4. http://localhost:8080/content/cassandra/D/100.json - Time per request: 
71.855 [ms]


Same round of test results, but each node retrieval done in a fresh server 
start.

1. http://localhost:8080/content/cassandra/A/100.json - Time per request: 
65.449  [ms] 
2. http://localhost:8080/content/cassandra/B/100.json - Time per request: 
236.641 [ms]
3. http://localhost:8080/content/cassandra/C/100.json - Time per request: 
260.856 [ms]
4. http://localhost:8080/content/cassandra/D/100.json - Time per request: 
233.855 [ms]





  was (Author: ddwijewardana):
First round of report in brief: P.S This results based on very first time 
retrieval of these nodes. 

1. http://localhost:8080/content/cassandra/A/100.json - Time per request: 
65.449 [ms] 
2. http://localhost:8080/content/cassandra/B/100.json - Time per request: 
73.022 [ms]
3. http://localhost:8080/content/cassandra/C/100.json - Time per request: 
61.696 [ms]
4. http://localhost:8080/content/cassandra/D/100.json - Time per request: 
71.855 [ms]
  
> Cassandra Resource Provider READ Latency Stats 
> ---
>
> Key: SLING-3026
> URL: https://issues.apache.org/jira/browse/SLING-3026
> Project: Sling
>  Issue Type: Task
>Reporter: Dishara Wijewardana
>Priority: Critical
> Attachments: SLING_CASSANDRA_LATENCY_STATS_22-08-2013.txt
>
>
> This is to keep track on the statistics of the latency for the requests done 
> on Cassandra layer through Cassandra Resource Provider. Here we use Apache 
> Benchmark. 
> We have a test profile java component in the cassandra module to add bulk 
> test data to cassandra. 
> /content/cassandra/A/0   to /content/cassandra/A/999
> /content/cassandra/B/0   to /content/cassandra/B/
> /content/cassandra/C/0   to /content/cassandra/C/9
> /content/cassandra/D/0   to /content/cassandra/D/99
> And then this JIRA will keep track of reports on the http request time to 
> retrieve 1 node from each following data collection.
>   

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Commented] (SLING-3026) Cassandra Resource Provider READ Latency Stats

2013-08-22 Thread Dishara Wijewardana (JIRA)

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

Dishara Wijewardana commented on SLING-3026:


First round of report in brief: P.S This results based on very first time 
retrieval of these nodes. 

1. http://localhost:8080/content/cassandra/A/100.json - Time per request: 
65.449 [ms] 
2. http://localhost:8080/content/cassandra/B/100.json - Time per request: 
73.022 [ms]
3. http://localhost:8080/content/cassandra/C/100.json - Time per request: 
61.696 [ms]
4. http://localhost:8080/content/cassandra/D/100.json - Time per request: 
71.855 [ms]

> Cassandra Resource Provider READ Latency Stats 
> ---
>
> Key: SLING-3026
> URL: https://issues.apache.org/jira/browse/SLING-3026
> Project: Sling
>  Issue Type: Task
>Reporter: Dishara Wijewardana
>Priority: Critical
> Attachments: SLING_CASSANDRA_LATENCY_STATS_22-08-2013.txt
>
>
> This is to keep track on the statistics of the latency for the requests done 
> on Cassandra layer through Cassandra Resource Provider. Here we use Apache 
> Benchmark. 
> We have a test profile java component in the cassandra module to add bulk 
> test data to cassandra. 
> /content/cassandra/A/0   to /content/cassandra/A/999
> /content/cassandra/B/0   to /content/cassandra/B/
> /content/cassandra/C/0   to /content/cassandra/C/9
> /content/cassandra/D/0   to /content/cassandra/D/99
> And then this JIRA will keep track of reports on the http request time to 
> retrieve 1 node from each following data collection.
>   

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Updated] (SLING-3026) Cassandra Resource Provider READ Latency Stats

2013-08-22 Thread Dishara Wijewardana (JIRA)

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

Dishara Wijewardana updated SLING-3026:
---

Attachment: SLING_CASSANDRA_LATENCY_STATS_22-08-2013.txt

Here I have attached the first round of report.

> Cassandra Resource Provider READ Latency Stats 
> ---
>
> Key: SLING-3026
> URL: https://issues.apache.org/jira/browse/SLING-3026
> Project: Sling
>  Issue Type: Task
>Reporter: Dishara Wijewardana
>Priority: Critical
> Attachments: SLING_CASSANDRA_LATENCY_STATS_22-08-2013.txt
>
>
> This is to keep track on the statistics of the latency for the requests done 
> on Cassandra layer through Cassandra Resource Provider. Here we use Apache 
> Benchmark. 
> We have a test profile java component in the cassandra module to add bulk 
> test data to cassandra. 
> /content/cassandra/A/0   to /content/cassandra/A/999
> /content/cassandra/B/0   to /content/cassandra/B/
> /content/cassandra/C/0   to /content/cassandra/C/9
> /content/cassandra/D/0   to /content/cassandra/D/99
> And then this JIRA will keep track of reports on the http request time to 
> retrieve 1 node from each following data collection.
>   

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Created] (SLING-3026) Cassandra Resource Provider READ Latency Stats

2013-08-22 Thread Dishara Wijewardana (JIRA)
Dishara Wijewardana created SLING-3026:
--

 Summary: Cassandra Resource Provider READ Latency Stats 
 Key: SLING-3026
 URL: https://issues.apache.org/jira/browse/SLING-3026
 Project: Sling
  Issue Type: Task
Reporter: Dishara Wijewardana
Priority: Critical


This is to keep track on the statistics of the latency for the requests done on 
Cassandra layer through Cassandra Resource Provider. Here we use Apache 
Benchmark. 

We have a test profile java component in the cassandra module to add bulk test 
data to cassandra. 

/content/cassandra/A/0   to /content/cassandra/A/999
/content/cassandra/B/0   to /content/cassandra/B/
/content/cassandra/C/0   to /content/cassandra/C/9
/content/cassandra/D/0   to /content/cassandra/D/99

And then this JIRA will keep track of reports on the http request time to 
retrieve 1 node from each following data collection.



  

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


Fwd: Problem with form based authentication

2013-08-22 Thread JCR

A follow up on this.
It works meanwhile, but the "solution" is a workaround nobody can get 
really happy...


I finally installed version 1.0.0. However, it only works when there is 
no assiated configuration with it.
Looks like it falls back to some factory standard that leave the bundle 
work properly. WITH a config file, form based authentication handler 
will react in the manner described below.


Now, as I really wish to set some specific configuration for several 
reasons, does anybody has an idea how to solve this or perhaps how it 
could be debugged?


Thanks,
Juerg


 Original Message 
Subject:Problem with form based authentication
Date:   Thu, 04 Jul 2013 23:49:34 +0200
From:   JCR 
Reply-To:   dev@sling.apache.org
To: dev@sling.apache.org



Hi all,

I'm about to switch to form based authentication for some of my sites.

I deployed the org.apache.sling.auth.form bundle in version 1.0.2 as I
believe that later versions are not compatible with CRX 2.2.

After some config, the login form pops up and sends the two required
fields j_username and j_password. Unfortunately, the request gets never
approved. Instead, the error.log says the following:

 ... org.apache.sling.auth.core.impl.SlingAuthenticator
handleLoginFailure: Unable to authenticate jurg: null

Most likely, this is generated by SlingAuthenticator.handleLoginFailure():

} else if (reason instanceof LoginException) {

 // request authentication information and send 403 (Forbidden)
 // if no handler can request authentication information.
 log.info("handleLoginFailure: Unable to authenticate {}: {}", user,
 reason.getMessage());


This now raises the following questions:

- using basic authentication, login with the same credentials works fine. So 
what's keeping form based authenticator from verifying the credentials properly?
- what causes the reason to be empty?

Thanks for any hint,
Juerg






[jira] [Commented] (SLING-2779) Support for default properties values of a resource

2013-08-22 Thread Carsten Ziegeler (JIRA)

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

Carsten Ziegeler commented on SLING-2779:
-

I think we should make this as simple as possible. Creating a copy of an 
immutable map, deleting properties and then passing it into the composite map, 
seems to be much easier for me than having all these edge cases within the 
composite value map.

> Support for default properties values of a resource
> ---
>
> Key: SLING-2779
> URL: https://issues.apache.org/jira/browse/SLING-2779
> Project: Sling
>  Issue Type: New Feature
>  Components: API
>Affects Versions: API 2.3.0
>Reporter: Gilles Knobloch
> Attachments: SLING-2779.patch
>
>
> I already noticed several times it would be useful to be able to specify a 
> default properties for a resource:
> * if the resource itself contains the property, it will override the default 
> one.
> * but if it doesn't, the default value is used.
> This could be done either via:
> * specifying a {{sling:defaults}} property on the resource, which contains 
> the path to the resource which properties will be used by default.
> * providing a default map of properties
> Attaching a patch for review.
> For testing purpose, I put it under {{org.apache.sling.defaults}}, but I 
> imagine it could go to {{org.apache.sling.api.resource}}.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


Re: 500 Error when obtaining a resource

2013-08-22 Thread Ian Boston
Hi,
IIUYC, the question is. Should I populate the map when its resolved,
or when its accessed.

A. If possible, only when its accessed, however, if that means that
you have to keep a Thrift connection in a certain state inside hector
(your using hector, right ?), then do it when its accessed... but be
prepared to exclude large properties.

Ideally you will only unpack what you want, when you are asked for it
from the Cassandra record, and not do unnecessary work.

Ian



On 22 August 2013 12:19, Dishara Wijewardana  wrote:
> Hi Ian,
> OK, I can populate the resource (one row) related data in to the map as you
> mention. Also it makes sense to make it dynamic.
> I have a question. At what time should I be making it dynamic and
> populating data.  i.e when  /content/cassandra/foo is getting called, the
> MAP should be pre populated.
>
> i.e I am doing a HTTP call  to a new Node
> http://localhost:8080/content/cassandra/pnode10/cnode10.
> - So at the moment, the information of /content/cassandra/pnode10/cnode10
> not in the Map.
> - Before Provider.getResource(/content/cassandra/pnode10/cnode10) getting
> called, I have to populate the Map with the key "
> /content/cassandra/pnode10/cnode10".
> - Question is when I should be doing this ?
>
> - One option is
> When Provider.getResource(/content/cassandra/pnode10/cnode10) called, first
> thing I should do is check the Map of the existence of the key "
> /content/cassandra/pnode10/cnode10" and populate the data. Then proceed
> with the rest of the code which will obtain the resource from cassandra and
> return the CassandraResource ? Is this OK?
>
> On Thu, Aug 22, 2013 at 12:54 PM, Ian Boston  wrote:
>
>> Hi,
>> Ahh sorry, I misunderstood the question.
>>
>> Initially, when adaptTo(ValueMap.class) is called, just return a small
>> static map. In every instance adapTo(ValueMap.class) should return a
>> small map with 2 values in it, perhaps the same values every time.
>> Which I think you do already so thats cool.
>>
>> Next, make the map dynamic and load it with the values of a columns
>> associated with a row.
>>
>> IIRC your Cassandra layout is 1 resource per row, the properties of
>> the resource as values in the row, the name of each property is the
>> name of the column and the value is the value. If thats not your
>> Cassandra layout, tell me what is is.
>>
>>
>> eg
>>
>> Columns: rowid, name, fullpath, lastModfified, lastModifiedBy
>> A Row:232342342, blogpost, blogposts/2011/12/20/blogpost, 12312312312,
>> ieb
>>
>> the map would be
>> {
>>rowid: 232342342,
>>name: blogpost,
>>fullpath: blogposts/2011/12/20/blogpost,
>>lastModified: 12312312312,
>>lastModifiedBy: ieb
>> }
>>
>>
>>
>>
>> Best Regards
>> Ian
>>
>> On 22 August 2013 04:36, Dishara Wijewardana 
>> wrote:
>> > Hi Ian,
>> > Need a small clarification. May be you have ,misunderstood me. Correct,
>> on
>> > request, my provider always returns one row. What I meant was, the
>> > CASSANDRA_MAP (similar to PLANETS hash map) should be populated 1M
>> entries
>> > with properties (key/values) prior to read 1M records. So my Map size is
>> 1M
>> > at that time. Did you got me ?
>> >
>> > i.e if I want to read
>> > http://localhost:8080/content/cassandra/pnode5/cnode5.json , my provider
>> > CASSANDRA_MAP should consists with the key
>> > "/content/cassandra/pnode5/cnode5" and value with be a ValueMap.
>> >
>> > So this should be same if I want to insert 1M records.
>> >
>> >
>> > On Tue, Aug 20, 2013 at 12:31 PM, Ian Boston  wrote:
>> >
>> >> Hi,
>> >>
>> >> Try adding a .json to the end of the url.
>> >> That should cause the json renderer to show you the properties.
>> >>
>> >> If you have any hierarchical content in Cassandra you can also test
>> >> that by specifying the number of levels to show.
>> >> Add .2.json
>> >>
>> >> That will cause the listChildren methods to be called.
>> >> There is more information on the Sling tutorial [1]. Try following the
>> >> tutorial again to remind yourself how JCR behaves.
>> >>
>> >> Your ResourceProvider should get a row from Cassandra on request, it
>> >> should not get all the rows from Cassandra, so you should never have
>> >> all 1M records in memory.
>> >>
>> >> Ian
>> >>
>> >>
>> >> 1
>> >>
>> http://sling.apache.org/documentation/getting-started/discover-sling-in-15-minutes.html
>> >>
>> >>
>> >> On 20 August 2013 04:22, Dishara Wijewardana 
>> >> wrote:
>> >> > Hi Ian,
>> >> > Thank you very much for the explanation.
>> >> > I did the changes and commited it. If you see on CassandraResource and
>> >> > CassandraResourceProvider,  you will see I have done similar to Planet
>> >> > Resource.  And when I do a
>> >> http://localhost:8080/cassandra/pnode1/cnode1/ I
>> >> > am not seeing any errors in BE and either nothing get seen on the
>> >> browser.
>> >> >  It's a  blank page with no errors.
>> >> >
>> >> > So apparently it seems work. And when I evaluated followings they
>> worked
>> >> > fine :-). I currently only added "pa

[jira] [Commented] (SLING-2780) Make ResourceMetadata read-only when delivered to client code

2013-08-22 Thread Gilles Knobloch (JIRA)

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

Gilles Knobloch commented on SLING-2780:


Broke prototype of SLING-2986 as well

> Make ResourceMetadata read-only when delivered to client code
> -
>
> Key: SLING-2780
> URL: https://issues.apache.org/jira/browse/SLING-2780
> Project: Sling
>  Issue Type: New Feature
>  Components: API, ResourceResolver
>Affects Versions: API 2.3.0, Resource Resolver 1.0.4
>Reporter: Carsten Ziegeler
>Assignee: Carsten Ziegeler
> Fix For: API 2.4.0, Resource Resolver 1.0.6
>
>
> As recently discussed in the mailing list, ResourceMetadata is an object 
> which provides additional metadata information about a resource but is not 
> intended to be changed by client code.
> As ResourceMetadata extends from (Hash)Map it is read/write by default and 
> might potentially be changed by client code.
> We should update the API docs that this object is read-only and also enforce 
> it in our implementation.
> It seems so far no one is changing the ResourceMetadata after it has left the 
> resource resolver, therefore we can make it read-only after it is returned by 
> the resource resolver.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


Re: 500 Error when obtaining a resource

2013-08-22 Thread Dishara Wijewardana
Hi Ian,
OK, I can populate the resource (one row) related data in to the map as you
mention. Also it makes sense to make it dynamic.
I have a question. At what time should I be making it dynamic and
populating data.  i.e when  /content/cassandra/foo is getting called, the
MAP should be pre populated.

i.e I am doing a HTTP call  to a new Node
http://localhost:8080/content/cassandra/pnode10/cnode10.
- So at the moment, the information of /content/cassandra/pnode10/cnode10
not in the Map.
- Before Provider.getResource(/content/cassandra/pnode10/cnode10) getting
called, I have to populate the Map with the key "
/content/cassandra/pnode10/cnode10".
- Question is when I should be doing this ?

- One option is
When Provider.getResource(/content/cassandra/pnode10/cnode10) called, first
thing I should do is check the Map of the existence of the key "
/content/cassandra/pnode10/cnode10" and populate the data. Then proceed
with the rest of the code which will obtain the resource from cassandra and
return the CassandraResource ? Is this OK?

On Thu, Aug 22, 2013 at 12:54 PM, Ian Boston  wrote:

> Hi,
> Ahh sorry, I misunderstood the question.
>
> Initially, when adaptTo(ValueMap.class) is called, just return a small
> static map. In every instance adapTo(ValueMap.class) should return a
> small map with 2 values in it, perhaps the same values every time.
> Which I think you do already so thats cool.
>
> Next, make the map dynamic and load it with the values of a columns
> associated with a row.
>
> IIRC your Cassandra layout is 1 resource per row, the properties of
> the resource as values in the row, the name of each property is the
> name of the column and the value is the value. If thats not your
> Cassandra layout, tell me what is is.
>
>
> eg
>
> Columns: rowid, name, fullpath, lastModfified, lastModifiedBy
> A Row:232342342, blogpost, blogposts/2011/12/20/blogpost, 12312312312,
> ieb
>
> the map would be
> {
>rowid: 232342342,
>name: blogpost,
>fullpath: blogposts/2011/12/20/blogpost,
>lastModified: 12312312312,
>lastModifiedBy: ieb
> }
>
>
>
>
> Best Regards
> Ian
>
> On 22 August 2013 04:36, Dishara Wijewardana 
> wrote:
> > Hi Ian,
> > Need a small clarification. May be you have ,misunderstood me. Correct,
> on
> > request, my provider always returns one row. What I meant was, the
> > CASSANDRA_MAP (similar to PLANETS hash map) should be populated 1M
> entries
> > with properties (key/values) prior to read 1M records. So my Map size is
> 1M
> > at that time. Did you got me ?
> >
> > i.e if I want to read
> > http://localhost:8080/content/cassandra/pnode5/cnode5.json , my provider
> > CASSANDRA_MAP should consists with the key
> > "/content/cassandra/pnode5/cnode5" and value with be a ValueMap.
> >
> > So this should be same if I want to insert 1M records.
> >
> >
> > On Tue, Aug 20, 2013 at 12:31 PM, Ian Boston  wrote:
> >
> >> Hi,
> >>
> >> Try adding a .json to the end of the url.
> >> That should cause the json renderer to show you the properties.
> >>
> >> If you have any hierarchical content in Cassandra you can also test
> >> that by specifying the number of levels to show.
> >> Add .2.json
> >>
> >> That will cause the listChildren methods to be called.
> >> There is more information on the Sling tutorial [1]. Try following the
> >> tutorial again to remind yourself how JCR behaves.
> >>
> >> Your ResourceProvider should get a row from Cassandra on request, it
> >> should not get all the rows from Cassandra, so you should never have
> >> all 1M records in memory.
> >>
> >> Ian
> >>
> >>
> >> 1
> >>
> http://sling.apache.org/documentation/getting-started/discover-sling-in-15-minutes.html
> >>
> >>
> >> On 20 August 2013 04:22, Dishara Wijewardana 
> >> wrote:
> >> > Hi Ian,
> >> > Thank you very much for the explanation.
> >> > I did the changes and commited it. If you see on CassandraResource and
> >> > CassandraResourceProvider,  you will see I have done similar to Planet
> >> > Resource.  And when I do a
> >> http://localhost:8080/cassandra/pnode1/cnode1/ I
> >> > am not seeing any errors in BE and either nothing get seen on the
> >> browser.
> >> >  It's a  blank page with no errors.
> >> >
> >> > So apparently it seems work. And when I evaluated followings they
> worked
> >> > fine :-). I currently only added "path" property only for the map.
> >> >
> >> >   ValueMap vm =
> >> >
> >>
> resourceResolver.get("/content/cassandra/testitem").adapTo(ValueMap.class);
> >> > Assert.assertNotNull(vm.get("path"));
> >> > Assert.assertTrue(((String)vm.get("path")).length()>0);
> >> >
> >> >
> >> > So how should we test 1M record test on top of this  (because I am
> >> getting
> >> > a blank response on the browser) ?. Even in that case I think I have
> to
> >> > populate the Map with 1M records for instance. (Correct me if I am
> >> wrong).
> >> > But if it is the case, this will consume quite a lot of memory to
> keep a
> >> 1M
> >> > size hash map.
> >> > Please advice how to

Re: [RT] Logging and Logback

2013-08-22 Thread Chetan Mehrotra
Hi,

I am done with most of the planned features with Sling Logabck extension
[1]. To summarize it supports following features

* Compatible with existing Sling Commons Log
* LogBack configuration can be provided via Logback config xml
* ConfigurationAdmin integration - Logback Config can be enhanced via
config obtained from OSGi configuration admin
* Supports Appenders via Whiteboard pattern
* Support providing Logback config as fragments through OSGi Service
Registry
* Feature rich WebConsole Plugin and Configuration Printer support

I have provided the implementation zip as part of SLING-2024. Current test
coverage stands at ~50%.

Some queries going forward

1. What should be the artifactId of the new implementation
Currently I have set the artifactid (and package names) as
org.apache.sling.extensions.logback. Should it be set to
org.apache.sling.commons.log with major version number upgrade. As that
would allow easier upgrades?

Kindly have a look at the patch provided and provide your feedback.

regards
Chetan

[1] https://github.com/chetanmeh/sling-logback
[2] https://issues.apache.org/jira/browse/SLING-2024
[3] http://logback.qos.ch/manual/configuration.html#fileInclusion
Chetan Mehrotra

On Tue, Aug 13, 2013 at 6:03 PM, Bertrand Delacretaz 
wrote:
> On Tue, Aug 13, 2013 at 1:48 PM, Chetan Mehrotra
>  wrote:
>> ...I just swapped the log
>> implementation in existing system and saw if the log were generated as
>> expected or not. Adding automated testcase for such scenarios would
>> take some decent effort...
>
> granted...but I think we need this as subtle differences in the log
> configuration mechanisms can lead to hard to troubleshoot issues in
> the field.
>
>>
>> So before I invest time in that wanted to see if there is interest in
>> the Logback based implementation...
>
> I haven't looked at your patch so far but in general I think it's a
> great idea, especially as it brings MDC and Markers with it.
>
> -Bertrand


Re: 500 Error when obtaining a resource

2013-08-22 Thread Ian Boston
Hi,
Ahh sorry, I misunderstood the question.

Initially, when adaptTo(ValueMap.class) is called, just return a small
static map. In every instance adapTo(ValueMap.class) should return a
small map with 2 values in it, perhaps the same values every time.
Which I think you do already so thats cool.

Next, make the map dynamic and load it with the values of a columns
associated with a row.

IIRC your Cassandra layout is 1 resource per row, the properties of
the resource as values in the row, the name of each property is the
name of the column and the value is the value. If thats not your
Cassandra layout, tell me what is is.


eg

Columns: rowid, name, fullpath, lastModfified, lastModifiedBy
A Row:232342342, blogpost, blogposts/2011/12/20/blogpost, 12312312312, ieb

the map would be
{
   rowid: 232342342,
   name: blogpost,
   fullpath: blogposts/2011/12/20/blogpost,
   lastModified: 12312312312,
   lastModifiedBy: ieb
}




Best Regards
Ian

On 22 August 2013 04:36, Dishara Wijewardana  wrote:
> Hi Ian,
> Need a small clarification. May be you have ,misunderstood me. Correct, on
> request, my provider always returns one row. What I meant was, the
> CASSANDRA_MAP (similar to PLANETS hash map) should be populated 1M entries
> with properties (key/values) prior to read 1M records. So my Map size is 1M
> at that time. Did you got me ?
>
> i.e if I want to read
> http://localhost:8080/content/cassandra/pnode5/cnode5.json , my provider
> CASSANDRA_MAP should consists with the key
> "/content/cassandra/pnode5/cnode5" and value with be a ValueMap.
>
> So this should be same if I want to insert 1M records.
>
>
> On Tue, Aug 20, 2013 at 12:31 PM, Ian Boston  wrote:
>
>> Hi,
>>
>> Try adding a .json to the end of the url.
>> That should cause the json renderer to show you the properties.
>>
>> If you have any hierarchical content in Cassandra you can also test
>> that by specifying the number of levels to show.
>> Add .2.json
>>
>> That will cause the listChildren methods to be called.
>> There is more information on the Sling tutorial [1]. Try following the
>> tutorial again to remind yourself how JCR behaves.
>>
>> Your ResourceProvider should get a row from Cassandra on request, it
>> should not get all the rows from Cassandra, so you should never have
>> all 1M records in memory.
>>
>> Ian
>>
>>
>> 1
>> http://sling.apache.org/documentation/getting-started/discover-sling-in-15-minutes.html
>>
>>
>> On 20 August 2013 04:22, Dishara Wijewardana 
>> wrote:
>> > Hi Ian,
>> > Thank you very much for the explanation.
>> > I did the changes and commited it. If you see on CassandraResource and
>> > CassandraResourceProvider,  you will see I have done similar to Planet
>> > Resource.  And when I do a
>> http://localhost:8080/cassandra/pnode1/cnode1/ I
>> > am not seeing any errors in BE and either nothing get seen on the
>> browser.
>> >  It's a  blank page with no errors.
>> >
>> > So apparently it seems work. And when I evaluated followings they worked
>> > fine :-). I currently only added "path" property only for the map.
>> >
>> >   ValueMap vm =
>> >
>> resourceResolver.get("/content/cassandra/testitem").adapTo(ValueMap.class);
>> > Assert.assertNotNull(vm.get("path"));
>> > Assert.assertTrue(((String)vm.get("path")).length()>0);
>> >
>> >
>> > So how should we test 1M record test on top of this  (because I am
>> getting
>> > a blank response on the browser) ?. Even in that case I think I have to
>> > populate the Map with 1M records for instance. (Correct me if I am
>> wrong).
>> > But if it is the case, this will consume quite a lot of memory to keep a
>> 1M
>> > size hash map.
>> > Please advice how to proceed.
>> >
>> > Thanks
>> >
>> >
>> > On Mon, Aug 19, 2013 at 1:40 PM, Ian Boston  wrote:
>> >
>> >> Hi,
>> >> Initially, just to verify that you can get the
>> >> CassandraResourceProvider to work, just take the code from the
>> >> PlanetProvider and send back a Map with 1 value (eg path).
>> >>
>> >> Once you have that working and can perform a get on the resource, then
>> >> you need to populate that map with the values associated with the
>> >> columns in the Cassandra row that represents the Cassandra resource.
>> >> To give the data in Cassandra some reality you can get you data
>> >> population code to add the following columns to every cassandra row.
>> >>
>> >> path : the path of the resource
>> >> created : a long representing the time (System.currentTimeMillis())
>> >> when the resource was created.
>> >>
>> >> when you have done that the following test code should be pass.
>> >>
>> >> ValueMap vm =
>> >>
>> resourceResolver.get("/content/cassandra/testitem").adapTo(ValueMap.class);
>> >> Assert.assertNotNull(vm.get("path"));
>> >> Assert.assertTrue(((String)vm.get("path")).length()>0);
>> >> Assert.assertNotNull(vm.get("created"));
>> >> Assert.assertTrue(((Long)vm.get("path")) <
>> System.currentTimeMillis());
>> >>
>> >> Best Regards
>> >> Ian
>> >>
>> >>
>> >> On 18 Aug

Re: [HTTP][Sling Resource] The webpage at http://localhost:8080/cassandra/pnode1/cnode1/ has resulted in too many redirects

2013-08-22 Thread Ian Boston
Hi Dishara,
Excellent, well done. The ResourceResolver is quite picky about whats
in the Resource and is also sensitive to trailing / on paths. I expect
you now know a lot more about how it works... which will be a good
thing for the tasks to come.
Well done.
Ian

On 22 August 2013 04:25, Dishara Wijewardana  wrote:
> Hi Ian,
> Found it finally :-).  You are quite right. I am missing the
> resolutionPathInfo property to send back and hence going to a wrong
> servlet. I set it to json and it gave me a json rendered page. Awesome !!.
>
>
> On Thu, Aug 22, 2013 at 7:57 AM, Dishara Wijewardana <
> ddwijeward...@gmail.com> wrote:
>
>> Hi Ian,
>> I found the place which redirects and causing the loop in debugging. This
>> is  for a similar request on
>> http://localhost:8080/content/cassandra/pnode1/cnode1.
>>
>> The class is StreamRendererServlet. My request always falls inside the
>> else block that specified in BOLD and it redirects the response and hence
>> this issue. So following is the status I noticed in the debug flow. Can you
>> give me some clues, whether this flow correct ? Should the "stream" be not
>> NULL ? Or included=true. What is the path the request should suppose to go
>> ? Appreciate any input since I am kind of blocked here..
>>
>> if (!included) {  *included=false*
>> ResourceMetadata meta = resource.getResourceMetadata();
>> long modifTime = meta.getModificationTime();
>> *
>> Inside unmodified request.getDateHeader(HEADER_IF_MODIFIED_SINCE) returns
>> -1 and hence if block evaluates to false.*
>> if (unmodified(request, modifTime)) {
>> response.setStatus(SC_NOT_MODIFIED);
>> return;
>> }
>> }
>>
>> // fall back to plain text rendering if the resource has no stream
>> InputStream stream = resource.adaptTo(InputStream.class);
>> if (stream != null) { *stream=NULL*
>>
>> streamResource(resource, stream, included, request, response);
>>
>> } else {
>>
>> // the resource is the root, do not redirect, immediately index
>> if (isRootResourceRequest(resource)) {
>>
>> renderDirectory(request, response, included);
>>
>> } else if (included || response.isCommitted() ) 
>> {*response.isCommitted()
>> = false  and included=false*
>>
>> // request is included or committed, not redirecting
>> request.getRequestProgressTracker().log(
>> "StreamRendererServlet: Not redirecting with trailing
>> slash, response is committed or request included");
>> log.warn("StreamRendererServlet: Not redirecting with
>> trailing slash, response is committed or request included");
>>
>> } *else {*
>> *
>> *
>> *// redirect to this with trailing slash to render the
>> index*
>> *String url = request.getResourceResolver().map(request,*
>> *resource.getPath())*
>> *+ "/";*
>> *response.sendRedirect(url);*
>> *
>> *
>> *}*
>> }
>>
>>
>>
>>
>>
>>
>> On Wed, Aug 21, 2013 at 4:16 PM, Ian Boston  wrote:
>>
>>> Hi,
>>> IIRC the behaviour where the resource resolver iterates up the tree is
>>> normal resource resolver behaviour but the recursion is not. Neither
>>> is the integration test failure.
>>>
>>> The resource resolver may be looking for the sling:resourceSuperType,
>>> but that is just a hunch.
>>>
>>> Either, the implementation of the ResourceProvider wiring inside the
>>> ResourceResolver is buggy, or the Properties of the resource you are
>>> sending back are incorrect, which is triggering the behaviour.
>>>
>>> I would suggest you look carefully at what a standard JcrResource
>>> looks like when you make a simular request. Its listed at [1].
>>>
>>> Ian
>>>
>>> 1 http://localhost:8080/system/console/recentRequests
>>>
>>>
>>> On 21 August 2013 08:59, Dishara Wijewardana 
>>> wrote:
>>> > Hi
>>> > Since I am doing something similar to PlanetResource, I ran the
>>> integration
>>> > test of PlanetResource to verify it works in trunk. But that also got
>>> > failed and started a thread on that also.
>>> >
>>> >
>>> > On Wed, Aug 21, 2013 at 8:50 AM, Dishara Wijewardana <
>>> > ddwijeward...@gmail.com> wrote:
>>> >
>>> >> Hi,
>>> >> As per Ian's request I tried calling a resource URL ends with .json to
>>> get
>>> >> a json rendered page.
>>> >> There I just noticed that, the response I am getting was which I
>>> claimed
>>> >> earlier a blank page, is not actually a blank page. Sorry for the
>>> >> inconvenience.
>>> >>
>>> >> In the browser there is a message as follows. So then I debug it
>>> again. I
>>> >> put a debug pointer only inside CassandraProvider.getResource(), and
>>> >> observed that it is getting hit continuously. I also noticed that if I
>>> hit
>>> >> for http://localhost:8080/content/cassandra/pnode1/cnode1 ,
>>> >> it conti

[jira] [Commented] (SLING-2024) Replace file logger with logback

2013-08-22 Thread Chetan Mehrotra (JIRA)

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

Chetan Mehrotra commented on SLING-2024:


The patch includes testcases. The Github url provides details about various 
features supported.

Currently the artifactid and package name are 
'org.apache.sling.extensions.logback'. Probably it can use the current 
artifactid for commons log so that upgrades are simpler

> Replace file logger with logback
> 
>
> Key: SLING-2024
> URL: https://issues.apache.org/jira/browse/SLING-2024
> Project: Sling
>  Issue Type: Improvement
>  Components: Commons
>Affects Versions: Commons Log 2.1.2
>Reporter: Carl Hall
> Attachments: 
> org.apache.sling.extensions.logback-0.0.1-SNAPSHOT-src.tar.gz
>
>
> Rather than doing the work internally of writing log messages to disk, the 
> internal log mechanism should use logback to handle the heavy lifting. This 
> also adds the ability to add appenders and other nifty logback features.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Updated] (SLING-2024) Replace file logger with logback

2013-08-22 Thread Chetan Mehrotra (JIRA)

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

Chetan Mehrotra updated SLING-2024:
---

Attachment: org.apache.sling.extensions.logback-0.0.1-SNAPSHOT-src.tar.gz

Logback implementation for Sling

Refer to 

https://github.com/chetanmeh/sling-logback for implementation details
http://markmail.org/thread/66hrpdixaahvtyy5 - For discussion thread



> Replace file logger with logback
> 
>
> Key: SLING-2024
> URL: https://issues.apache.org/jira/browse/SLING-2024
> Project: Sling
>  Issue Type: Improvement
>  Components: Commons
>Affects Versions: Commons Log 2.1.2
>Reporter: Carl Hall
> Attachments: 
> org.apache.sling.extensions.logback-0.0.1-SNAPSHOT-src.tar.gz
>
>
> Rather than doing the work internally of writing log messages to disk, the 
> internal log mechanism should use logback to handle the heavy lifting. This 
> also adds the ability to add appenders and other nifty logback features.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira