[CONF] Apache Sling FAQ
FAQ Page comment added by Anonym your link to http://cwiki.apache.org/SLING/who-is-using-sling-.html is down, and there is no contact form / email to report to. Stop watching space | Change email notification preferences View Online | Reply To This
svn commit: r1508040 - in /sling/trunk/contrib/extensions/healthcheck: hc-rules/ hc-rules/src/main/java/org/apache/sling/hc/rules/osgi/ hc-rules/src/main/java/org/apache/sling/hc/rules/scriptable/ hc-
Author: bdelacretaz Date: Mon Jul 29 13:00:49 2013 New Revision: 1508040 URL: http://svn.apache.org/r1508040 Log: SLING-2983 - scripted health check rules, including examples Added: sling/trunk/contrib/extensions/healthcheck/hc-rules/src/main/java/org/apache/sling/hc/rules/scriptable/ sling/trunk/contrib/extensions/healthcheck/hc-rules/src/main/java/org/apache/sling/hc/rules/scriptable/ScriptableRuleBuilder.java sling/trunk/contrib/extensions/healthcheck/hc-rules/src/test/java/org/apache/sling/hc/rules/impl/ScriptableRuleBuilderTest.java sling/trunk/contrib/extensions/healthcheck/sling-demo/src/main/resources/SLING-CONTENT/apps/hc/demo/scripted-ecma.json sling/trunk/contrib/extensions/healthcheck/sling-demo/src/main/resources/SLING-CONTENT/apps/hc/demo/scripted-groovy.json Modified: sling/trunk/contrib/extensions/healthcheck/hc-rules/pom.xml sling/trunk/contrib/extensions/healthcheck/hc-rules/src/main/java/org/apache/sling/hc/rules/osgi/Activator.java Modified: sling/trunk/contrib/extensions/healthcheck/hc-rules/pom.xml URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/healthcheck/hc-rules/pom.xml?rev=1508040r1=1508039r2=1508040view=diff == --- sling/trunk/contrib/extensions/healthcheck/hc-rules/pom.xml (original) +++ sling/trunk/contrib/extensions/healthcheck/hc-rules/pom.xml Mon Jul 29 13:00:49 2013 @@ -50,6 +50,17 @@ target1.6/target /configuration /plugin + plugin + groupIdorg.codehaus.mojo/groupId + artifactIdanimal-sniffer-maven-plugin/artifactId + configuration +signature + groupIdorg.codehaus.mojo.signature/groupId + artifactIdjava16/artifactId + version1.0/version +/signature + /configuration +/plugin /plugins /build @@ -88,5 +99,11 @@ version4.8.1/version scopetest/scope /dependency +dependency +groupIdorg.mockito/groupId +artifactIdmockito-core/artifactId +version1.9.5/version +scopetest/scope +/dependency /dependencies /project Modified: sling/trunk/contrib/extensions/healthcheck/hc-rules/src/main/java/org/apache/sling/hc/rules/osgi/Activator.java URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/healthcheck/hc-rules/src/main/java/org/apache/sling/hc/rules/osgi/Activator.java?rev=1508040r1=1508039r2=1508040view=diff == --- sling/trunk/contrib/extensions/healthcheck/hc-rules/src/main/java/org/apache/sling/hc/rules/osgi/Activator.java (original) +++ sling/trunk/contrib/extensions/healthcheck/hc-rules/src/main/java/org/apache/sling/hc/rules/osgi/Activator.java Mon Jul 29 13:00:49 2013 @@ -22,6 +22,7 @@ import java.util.List; import org.apache.sling.hc.api.RuleBuilder; import org.apache.sling.hc.rules.jmx.JmxBeansRuleBuilder; +import org.apache.sling.hc.rules.scriptable.ScriptableRuleBuilder; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceRegistration; @@ -34,6 +35,7 @@ public class Activator implements Bundle regs = new ArrayListServiceRegistration(); regs.add(ctx.registerService(RuleBuilder.class.getName(), new BundlesRuleBuilder(ctx), null)); regs.add(ctx.registerService(RuleBuilder.class.getName(), new JmxBeansRuleBuilder(), null)); +regs.add(ctx.registerService(RuleBuilder.class.getName(), new ScriptableRuleBuilder(ctx), null)); } public void stop(BundleContext ctx) throws Exception { Added: sling/trunk/contrib/extensions/healthcheck/hc-rules/src/main/java/org/apache/sling/hc/rules/scriptable/ScriptableRuleBuilder.java URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/healthcheck/hc-rules/src/main/java/org/apache/sling/hc/rules/scriptable/ScriptableRuleBuilder.java?rev=1508040view=auto == --- sling/trunk/contrib/extensions/healthcheck/hc-rules/src/main/java/org/apache/sling/hc/rules/scriptable/ScriptableRuleBuilder.java (added) +++ sling/trunk/contrib/extensions/healthcheck/hc-rules/src/main/java/org/apache/sling/hc/rules/scriptable/ScriptableRuleBuilder.java Mon Jul 29 13:00:49 2013 @@ -0,0 +1,125 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The SF licenses this file + * to you under the Apache License, Version 2.0 (the + * License); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + *
svn commit: r1508042 - /sling/site/trunk/content/documentation/bundles/sling-health-check-tool.mdtext
Author: bdelacretaz Date: Mon Jul 29 13:07:23 2013 New Revision: 1508042 URL: http://svn.apache.org/r1508042 Log: link to example rules Modified: sling/site/trunk/content/documentation/bundles/sling-health-check-tool.mdtext Modified: sling/site/trunk/content/documentation/bundles/sling-health-check-tool.mdtext URL: http://svn.apache.org/viewvc/sling/site/trunk/content/documentation/bundles/sling-health-check-tool.mdtext?rev=1508042r1=1508041r2=1508042view=diff == --- sling/site/trunk/content/documentation/bundles/sling-health-check-tool.mdtext (original) +++ sling/site/trunk/content/documentation/bundles/sling-health-check-tool.mdtext Mon Jul 29 13:07:23 2013 @@ -13,9 +13,11 @@ Custom rules can be created by supplying The source code of the hc modules is at [http://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/healthcheck](http://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/healthcheck). -## How to test the provided demo rules -The health check tool is currently (June 2013) not included in the default Sling launchpad, so you need to add -the required bundles to a Sling trunk instance to run the demo, as follows: +## Example rules +A set of example rules is provided as [initial content in the sling-demo module][1]. + +To test them, you need to add the required bundles to a Sling trunk instance, as shown below, as the health check tool +bundles are currently (July 2013) not included in the default Sling launchpad. 1. Start a standalone Sling instance from _launchpad/builder_ 1. Optionally install the _org.apache.sling.junit.core_ bundle, version 1.0.8 or later, if you want to enable JUnit-based rules.
svn commit: r871703 - in /websites/staging/sling/trunk/content: ./ documentation/bundles/sling-health-check-tool.html
Author: buildbot Date: Mon Jul 29 13:07:33 2013 New Revision: 871703 Log: Staging update by buildbot for sling Modified: websites/staging/sling/trunk/content/ (props changed) websites/staging/sling/trunk/content/documentation/bundles/sling-health-check-tool.html Propchange: websites/staging/sling/trunk/content/ -- --- cms:source-revision (original) +++ cms:source-revision Mon Jul 29 13:07:33 2013 @@ -1 +1 @@ -1507324 +1508042 Modified: websites/staging/sling/trunk/content/documentation/bundles/sling-health-check-tool.html == --- websites/staging/sling/trunk/content/documentation/bundles/sling-health-check-tool.html (original) +++ websites/staging/sling/trunk/content/documentation/bundles/sling-health-check-tool.html Mon Jul 29 13:07:33 2013 @@ -93,9 +93,10 @@ and via JMX./p accounts, JUnit tests results and the output of scripts written in any language supported by Sling./p pCustom rules can be created by supplying emRuleBuilder/em OSGi services, see the emhc-sling/em and emsling-demo/em modules for examples./p pThe source code of the hc modules is at a href=http://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/healthcheck;http://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/healthcheck/a./p -h2 id=how-to-test-the-provided-demo-rulesHow to test the provided demo rules/h2 -pThe health check tool is currently (June 2013) not included in the default Sling launchpad, so you need to add -the required bundles to a Sling trunk instance to run the demo, as follows:/p +h2 id=example-rulesExample rules/h2 +pA set of example rules is provided as [initial content in the sling-demo module][1]./p +pTo test them, you need to add the required bundles to a Sling trunk instance, as shown below, as the health check tool +bundles are currently (July 2013) not included in the default Sling launchpad./p ol liStart a standalone Sling instance from emlaunchpad/builder/em/li liOptionally install the emorg.apache.sling.junit.core/em bundle, version 1.0.8 or later, if you want to enable JUnit-based rules./li @@ -127,7 +128,7 @@ data is read-only./p h2 id=known-issuesKnown issues/h2 pSee a href=https://issues.apache.org/jira/browse/SLING-2822;SLING-2822/a for details./p div class=timestamp style=margin-top: 30px; font-size: 80%; text-align: right; -Rev. 1506477 by bdelacretaz on Wed, 24 Jul 2013 09:57:04 + +Rev. 1508042 by bdelacretaz on Mon, 29 Jul 2013 13:07:23 + /div div class=trademarkFooter Apache Sling, Sling, Apache, the Apache feather logo, and the Apache Sling project
[CONF] Apache Sling FAQ
FAQ Comment removed by Felix Meschberger your link to http://cwiki.apache.org/SLING/who-is-using-sling-.html is down, and there is no contact form / email to report to. Stop watching space | Change email notification preferences
svn commit: r871704 - in /websites/staging/sling/trunk/content: ./ documentation/bundles/sling-health-check-tool.html
Author: buildbot Date: Mon Jul 29 13:08:55 2013 New Revision: 871704 Log: Staging update by buildbot for sling Modified: websites/staging/sling/trunk/content/ (props changed) websites/staging/sling/trunk/content/documentation/bundles/sling-health-check-tool.html Propchange: websites/staging/sling/trunk/content/ -- --- cms:source-revision (original) +++ cms:source-revision Mon Jul 29 13:08:55 2013 @@ -1 +1 @@ -1508042 +1508044 Modified: websites/staging/sling/trunk/content/documentation/bundles/sling-health-check-tool.html == --- websites/staging/sling/trunk/content/documentation/bundles/sling-health-check-tool.html (original) +++ websites/staging/sling/trunk/content/documentation/bundles/sling-health-check-tool.html Mon Jul 29 13:08:55 2013 @@ -94,7 +94,7 @@ accounts, JUnit tests results and the ou pCustom rules can be created by supplying emRuleBuilder/em OSGi services, see the emhc-sling/em and emsling-demo/em modules for examples./p pThe source code of the hc modules is at a href=http://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/healthcheck;http://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/healthcheck/a./p h2 id=example-rulesExample rules/h2 -pA set of example rules is provided as [initial content in the sling-demo module][1]./p +pA set of example rules is provided as a href=http://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/healthcheck/sling-demo/src/main/resources/SLING-CONTENT/apps/hc/demo;initial content in the sling-demo module/a./p pTo test them, you need to add the required bundles to a Sling trunk instance, as shown below, as the health check tool bundles are currently (July 2013) not included in the default Sling launchpad./p ol @@ -128,7 +128,7 @@ data is read-only./p h2 id=known-issuesKnown issues/h2 pSee a href=https://issues.apache.org/jira/browse/SLING-2822;SLING-2822/a for details./p div class=timestamp style=margin-top: 30px; font-size: 80%; text-align: right; -Rev. 1508042 by bdelacretaz on Mon, 29 Jul 2013 13:07:23 + +Rev. 1508044 by bdelacretaz on Mon, 29 Jul 2013 13:08:49 + /div div class=trademarkFooter Apache Sling, Sling, Apache, the Apache feather logo, and the Apache Sling project
svn commit: r1508044 - /sling/site/trunk/content/documentation/bundles/sling-health-check-tool.mdtext
Author: bdelacretaz Date: Mon Jul 29 13:08:49 2013 New Revision: 1508044 URL: http://svn.apache.org/r1508044 Log: add missing link Modified: sling/site/trunk/content/documentation/bundles/sling-health-check-tool.mdtext Modified: sling/site/trunk/content/documentation/bundles/sling-health-check-tool.mdtext URL: http://svn.apache.org/viewvc/sling/site/trunk/content/documentation/bundles/sling-health-check-tool.mdtext?rev=1508044r1=1508043r2=1508044view=diff == --- sling/site/trunk/content/documentation/bundles/sling-health-check-tool.mdtext (original) +++ sling/site/trunk/content/documentation/bundles/sling-health-check-tool.mdtext Mon Jul 29 13:08:49 2013 @@ -58,4 +58,7 @@ data is read-only. ## Known issues -See [SLING-2822](https://issues.apache.org/jira/browse/SLING-2822) for details. \ No newline at end of file +See [SLING-2822](https://issues.apache.org/jira/browse/SLING-2822) for details. + + + [1]: http://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/healthcheck/sling-demo/src/main/resources/SLING-CONTENT/apps/hc/demo \ No newline at end of file
[CONF] Apache Sling FAQ
FAQ Page edited by Felix Meschberger Changes (2) ... {note:title=This page is *not* meant for asking questions} Use the Sling users mailing lists for that, see http://sling.apache.org/site/project-information.html#ProjectInformation-lists http://sling.apache.org/project-information.html#mailing-lists - this page is about _answers_. Thanks! If you find anything wrong in the [Sling site|http://sling.apache.org] or in and on the Wiki, do not hesitate to also contact the users mailing list. Thanks. {note} ... Full Content Frequently Asked Questions This page lists a series of common questions and answers. It is of course work in progress ... This page is not meant for asking questionsUse the Sling users mailing lists for that, see http://sling.apache.org/project-information.html#mailing-lists - this page is about answers. Thanks! If you find anything wrong in the Sling site or in and on the Wiki, do not hesitate to also contact the user's mailing list. Thanks. Administration How do I change Jackrabbit's admin password? RESTful API How do I create a node by posting a json document to a URL? What so special about the 'content','apps' and '*' urls? I posted a resource, where did it go? How to I create a multi-value property with a single value, in HTTP? I cannot add a node under /content/config.author using a POST, the new node goes under /content/config Scripts and Servlets How do I generate links to previous versions of a node? How do I find out why a given script or servlet is preferred to another when processing a request? How do I render a script for a star "*" resource? How to replace the default json renderer (for example) with my own? How to execute scripts directly? How do I create a new script engine? Working with bundles Is there an easy way to update bundles in a running installation during development? Classloading issues Accessing Classes from the Environment How are the sling.bootdelegation properties used ? How does Sling support the org.osgi.framework.system.packages Property ? Should the org.osgi.framework.bootdelegation or the org.osgi.framework.system.packages Property be used ? How to share session between Sling and other web applications? Miscellaneous Why can't I connect to Sling's WebDAV using Windows NetworkDriveMapping ? Why is my WebDAV connection so slow on Windows ? Why should I use the sling:Folder node type instead of nt:folder ? How to change the service.ranking of a service through configuration? Administration How do I change Jackrabbit's admin password? Using the userManager: curl \ -F"oldPwd=admin" \ -F"newPwd=Fritz" \ -F"newPwdConfirm=Fritz" \ http://admin:admin@localhost:8080/system/userManager/user/admin.changePassword.html You will also have to set that password in the Felix Web Management Console (/system/console/configMgr) under "Apache Sling Embedded JCR Repository." This is used by Sling to create an admin JCR session (using SlingRepository.loginAdministrative()) for components that need to have full access to the repository. Note: Only after restarting the framework the old password will become invalid (as of 09-11-10). Note: depending on the login module used in Jackrabbit, the password might not be checked at all (SimpleLoginModule, standard in Jackrabbit = 1.4). Since Jackrabbit 1.5, the DefaultLoginModule provides full user support. RESTful API How do I create a node by posting a json document to a URL? At the moment, you cannot do this. (Soon to change as per SLING-1172) Instead, each value must be a field in the request POST. For example, suppose you have the json document: { "greetings":"Hello, World!", "multi" : ["first","second"], "translations" : { "en": "Hello", "zh", "你好" } } You would do a post such as: curl -F"greetings=Hello, World!" -F"mult=first" -F"multi=second" -F"translations/en=Hello" -F"translations/zh=你好" http://admin:admin@localhost:8080/content/../../.. What so special about the 'content','apps' and '*' urls? 'apps' is reserved for matching scripts evaluated by sling. The "*" url is used for POSTing to a child node. By default, if a resource cannot be found from the root url, sling will try appending "content". For example, if you request the following non-existent resource: http://localhost:8080/blog/first_post Sling will look in: http://localhost:8080/content/blog/first_post Before returning a 404. I posted a resource, where did it go? Let's start by creating a resource: curl -F"greetings=Hello, World" -F"translations/en=Hello"
svn commit: r871706 - /websites/production/sling/content/
Author: bdelacretaz Date: Mon Jul 29 13:12:09 2013 New Revision: 871706 Log: point to health check rules examples Added: websites/production/sling/content/ - copied from r871705, websites/staging/sling/trunk/content/
svn commit: r1508067 - in /sling/trunk/contrib/extensions/healthcheck/sling-demo/src/main/resources/SLING-CONTENT/apps/hc/demo: ecma-jmx-and.json groovy-jmx-and.json
Author: bdelacretaz Date: Mon Jul 29 13:48:06 2013 New Revision: 1508067 URL: http://svn.apache.org/r1508067 Log: SLING-2983 - jmx binding for easy access to jmx attributes in scripted rules Added: sling/trunk/contrib/extensions/healthcheck/sling-demo/src/main/resources/SLING-CONTENT/apps/hc/demo/ecma-jmx-and.json sling/trunk/contrib/extensions/healthcheck/sling-demo/src/main/resources/SLING-CONTENT/apps/hc/demo/groovy-jmx-and.json Added: sling/trunk/contrib/extensions/healthcheck/sling-demo/src/main/resources/SLING-CONTENT/apps/hc/demo/ecma-jmx-and.json URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/healthcheck/sling-demo/src/main/resources/SLING-CONTENT/apps/hc/demo/ecma-jmx-and.json?rev=1508067view=auto == --- sling/trunk/contrib/extensions/healthcheck/sling-demo/src/main/resources/SLING-CONTENT/apps/hc/demo/ecma-jmx-and.json (added) +++ sling/trunk/contrib/extensions/healthcheck/sling-demo/src/main/resources/SLING-CONTENT/apps/hc/demo/ecma-jmx-and.json Mon Jul 29 13:48:06 2013 @@ -0,0 +1,9 @@ +{ + sling:resourceType : sling/healthcheck/rules, + namespace: script, + ruleName: Example javascript expression that combines two JMX attributes, + qualifier: ecma, + expression: 'jmx.attribute(java.lang:type=ClassLoading, LoadedClassCount) 100 jmx.attribute(osgi.core:type=framework,version=1.5,FrameworkStartLevel) 1', + tags : [script,javascript, jmx ], + jcr:primaryType: nt:unstructured +} \ No newline at end of file Added: sling/trunk/contrib/extensions/healthcheck/sling-demo/src/main/resources/SLING-CONTENT/apps/hc/demo/groovy-jmx-and.json URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/healthcheck/sling-demo/src/main/resources/SLING-CONTENT/apps/hc/demo/groovy-jmx-and.json?rev=1508067view=auto == --- sling/trunk/contrib/extensions/healthcheck/sling-demo/src/main/resources/SLING-CONTENT/apps/hc/demo/groovy-jmx-and.json (added) +++ sling/trunk/contrib/extensions/healthcheck/sling-demo/src/main/resources/SLING-CONTENT/apps/hc/demo/groovy-jmx-and.json Mon Jul 29 13:48:06 2013 @@ -0,0 +1,9 @@ +{ + sling:resourceType : sling/healthcheck/rules, + namespace: script, + ruleName: Example Groovy expression that combines two JMX attributes, + qualifier: groovy, + expression: 'jmx.attribute(java.lang:type=ClassLoading, LoadedClassCount) 100 jmx.attribute(osgi.core:type=framework,version=1.5,FrameworkStartLevel) 1', + tags : [script,groovy, jmx ], + jcr:primaryType: nt:unstructured +} \ No newline at end of file
svn commit: r1508072 - /sling/site/trunk/content/documentation/bundles/sling-health-check-tool.mdtext
Author: bdelacretaz Date: Mon Jul 29 13:59:28 2013 New Revision: 1508072 URL: http://svn.apache.org/r1508072 Log: Document scripted JMX rules Modified: sling/site/trunk/content/documentation/bundles/sling-health-check-tool.mdtext Modified: sling/site/trunk/content/documentation/bundles/sling-health-check-tool.mdtext URL: http://svn.apache.org/viewvc/sling/site/trunk/content/documentation/bundles/sling-health-check-tool.mdtext?rev=1508072r1=1508071r2=1508072view=diff == --- sling/site/trunk/content/documentation/bundles/sling-health-check-tool.mdtext (original) +++ sling/site/trunk/content/documentation/bundles/sling-health-check-tool.mdtext Mon Jul 29 13:59:28 2013 @@ -39,7 +39,28 @@ The screenshot below shows an example, a ![](sling-hc-plugin.jpg) -## JMX access to Health Check Rules results +## JMX interfaces + +### Accessing and combining JMX attributes in scripted rules +Although the basic _jmxbeans_ rules give access to single JMX attribute values in rules, a more powerful way to access +JMX attributes is to use scripted rules, where mini-scripts can be written to combine and check multiple values. + +The rule definition shown below, for example, checks two JMX attributes. Such scripted rules can be written in any scripting language +that Sling supports, which allows for creating rules that check JMX attributes against other values. + +{ +sling:resourceType : sling/healthcheck/rules, +namespace: script, +ruleName: Example javascript expression that combines two JMX attributes, +qualifier: ecma, +expression: +'jmx.attribute(java.lang:type=ClassLoading, LoadedClassCount) 100 + jmx.attribute(osgi.core:type=framework,version=1.5,FrameworkStartLevel) 1', +tags : [script,javascript, jmx ], +jcr:primaryType: nt:unstructured +} + +### JMX access to Health Check Rules results Creating _org.apache.sling.hc.sling.impl.RulesMBeans_ OSGi configurations causes the results of health check rules to be made available via JMX MBeans in the _org.apache.sling.healthcheck_ JMX tree. @@ -60,5 +81,4 @@ data is read-only. ## Known issues See [SLING-2822](https://issues.apache.org/jira/browse/SLING-2822) for details. - [1]: http://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/healthcheck/sling-demo/src/main/resources/SLING-CONTENT/apps/hc/demo \ No newline at end of file
svn commit: r871712 - in /websites/staging/sling/trunk/content: ./ documentation/bundles/sling-health-check-tool.html
Author: buildbot Date: Mon Jul 29 13:59:36 2013 New Revision: 871712 Log: Staging update by buildbot for sling Modified: websites/staging/sling/trunk/content/ (props changed) websites/staging/sling/trunk/content/documentation/bundles/sling-health-check-tool.html Propchange: websites/staging/sling/trunk/content/ -- --- cms:source-revision (original) +++ cms:source-revision Mon Jul 29 13:59:36 2013 @@ -1 +1 @@ -1508044 +1508072 Modified: websites/staging/sling/trunk/content/documentation/bundles/sling-health-check-tool.html == --- websites/staging/sling/trunk/content/documentation/bundles/sling-health-check-tool.html (original) +++ websites/staging/sling/trunk/content/documentation/bundles/sling-health-check-tool.html Mon Jul 29 13:59:36 2013 @@ -113,7 +113,27 @@ plugin form, or using them as selectors tags and optionally showing only results from rules that have something to report (as in no news is good news)./p pThe screenshot below shows an example, as of svn revision 1490286./p pimg alt= src=sling-hc-plugin.jpg //p -h2 id=jmx-access-to-health-check-rules-resultsJMX access to Health Check Rules results/h2 +h2 id=jmx-interfacesJMX interfaces/h2 +h3 id=accessing-and-combining-jmx-attributes-in-scripted-rulesAccessing and combining JMX attributes in scripted rules/h3 +pAlthough the basic emjmxbeans/em rules give access to single JMX attribute values in rules, a more powerful way to access +JMX attributes is to use scripted rules, where mini-scripts can be written to combine and check multiple values./p +pThe rule definition shown below, for example, checks two JMX attributes. Such scripted rules can be written in any scripting language +that Sling supports, which allows for creating rules that check JMX attributes against other values./p +div class=codehiliteprespan class=p{/span +quot;span class=nsling/spanspan class=p:/spanspan class=nresourceType/spanquot; span class=p:/span quot;span class=nsling/spanspan class=o//spanspan class=nhealthcheck/spanspan class=o//spanspan class=nrules/spanquot;span class=p,/span +quot;span class=nnamespace/spanquot;span class=p:/span quot;span class=nscript/spanquot;span class=p,/span +quot;span class=nruleName/spanquot;span class=p:/span quot;span class=nExample/span span class=njavascript/span span class=nexpression/span span class=nthat/span span class=ncombines/span span class=ntwo/span span class=nJMX/span span class=nattributes/spanquot;span class=p,/span +quot;span class=nqualifier/spanquot;span class=p:/span quot;span class=necma/spanquot;span class=p,/span +quot;span class=nexpression/spanquot;span class=p:/span +span class=s#39;jmx.attribute(quot;java.lang:type=ClassLoadingquot;, quot;LoadedClassCountquot;) gt; 100 /span +span class=samp;amp; jmx.attribute(quot;osgi.core:type=framework,version=1.5quot;,quot;FrameworkStartLevelquot;) gt; 1#39;/spanspan class=p,/span +quot;span class=ntags/spanquot; span class=p:/span span class=p[/spanquot;span class=nscript/spanquot;span class=p,/spanquot;span class=njavascript/spanquot;span class=p,/span quot;span class=njmx/spanquot; span class=p],/span +quot;span class=njcr/spanspan class=p:/spanspan class=nprimaryType/spanquot;span class=p:/span quot;span class=nnt/spanspan class=p:/spanspan class=nunstructured/spanquot; +span class=p}/span +/pre/div + + +h3 id=jmx-access-to-health-check-rules-resultsJMX access to Health Check Rules results/h3 pCreating emorg.apache.sling.hc.sling.impl.RulesMBeans/em OSGi configurations causes the results of health check rules to be made available via JMX MBeans in the emorg.apache.sling.healthcheck/em JMX tree./p pThe slingdemo module provides an example configuration, which is used in the screenshot below./p @@ -128,7 +148,7 @@ data is read-only./p h2 id=known-issuesKnown issues/h2 pSee a href=https://issues.apache.org/jira/browse/SLING-2822;SLING-2822/a for details./p div class=timestamp style=margin-top: 30px; font-size: 80%; text-align: right; -Rev. 1508044 by bdelacretaz on Mon, 29 Jul 2013 13:08:49 + +Rev. 1508072 by bdelacretaz on Mon, 29 Jul 2013 13:59:28 + /div div class=trademarkFooter Apache Sling, Sling, Apache, the Apache feather logo, and the Apache Sling project
svn commit: r871713 - in /websites/staging/sling/trunk/content: ./ documentation/bundles/sling-health-check-tool.html
Author: buildbot Date: Mon Jul 29 14:01:32 2013 New Revision: 871713 Log: Staging update by buildbot for sling Modified: websites/staging/sling/trunk/content/ (props changed) websites/staging/sling/trunk/content/documentation/bundles/sling-health-check-tool.html Propchange: websites/staging/sling/trunk/content/ -- --- cms:source-revision (original) +++ cms:source-revision Mon Jul 29 14:01:32 2013 @@ -1 +1 @@ -1508072 +1508073 Modified: websites/staging/sling/trunk/content/documentation/bundles/sling-health-check-tool.html == --- websites/staging/sling/trunk/content/documentation/bundles/sling-health-check-tool.html (original) +++ websites/staging/sling/trunk/content/documentation/bundles/sling-health-check-tool.html Mon Jul 29 14:01:32 2013 @@ -118,7 +118,7 @@ tags and optionally showing only results pAlthough the basic emjmxbeans/em rules give access to single JMX attribute values in rules, a more powerful way to access JMX attributes is to use scripted rules, where mini-scripts can be written to combine and check multiple values./p pThe rule definition shown below, for example, checks two JMX attributes. Such scripted rules can be written in any scripting language -that Sling supports, which allows for creating rules that check JMX attributes against other values./p +that Sling supports, selected by an extension (ecma, groovy etc.) specified in the rule qualifier. /p div class=codehiliteprespan class=p{/span quot;span class=nsling/spanspan class=p:/spanspan class=nresourceType/spanquot; span class=p:/span quot;span class=nsling/spanspan class=o//spanspan class=nhealthcheck/spanspan class=o//spanspan class=nrules/spanquot;span class=p,/span quot;span class=nnamespace/spanquot;span class=p:/span quot;span class=nscript/spanquot;span class=p,/span @@ -148,7 +148,7 @@ data is read-only./p h2 id=known-issuesKnown issues/h2 pSee a href=https://issues.apache.org/jira/browse/SLING-2822;SLING-2822/a for details./p div class=timestamp style=margin-top: 30px; font-size: 80%; text-align: right; -Rev. 1508072 by bdelacretaz on Mon, 29 Jul 2013 13:59:28 + +Rev. 1508073 by bdelacretaz on Mon, 29 Jul 2013 14:01:25 + /div div class=trademarkFooter Apache Sling, Sling, Apache, the Apache feather logo, and the Apache Sling project
svn commit: r1508073 - /sling/site/trunk/content/documentation/bundles/sling-health-check-tool.mdtext
Author: bdelacretaz Date: Mon Jul 29 14:01:25 2013 New Revision: 1508073 URL: http://svn.apache.org/r1508073 Log: less verbose Modified: sling/site/trunk/content/documentation/bundles/sling-health-check-tool.mdtext Modified: sling/site/trunk/content/documentation/bundles/sling-health-check-tool.mdtext URL: http://svn.apache.org/viewvc/sling/site/trunk/content/documentation/bundles/sling-health-check-tool.mdtext?rev=1508073r1=1508072r2=1508073view=diff == --- sling/site/trunk/content/documentation/bundles/sling-health-check-tool.mdtext (original) +++ sling/site/trunk/content/documentation/bundles/sling-health-check-tool.mdtext Mon Jul 29 14:01:25 2013 @@ -46,7 +46,7 @@ Although the basic _jmxbeans_ rules give JMX attributes is to use scripted rules, where mini-scripts can be written to combine and check multiple values. The rule definition shown below, for example, checks two JMX attributes. Such scripted rules can be written in any scripting language -that Sling supports, which allows for creating rules that check JMX attributes against other values. +that Sling supports, selected by an extension (ecma, groovy etc.) specified in the rule qualifier. { sling:resourceType : sling/healthcheck/rules,
svn commit: r1508074 - /sling/site/trunk/content/documentation/bundles/sling-health-check-tool.mdtext
Author: bdelacretaz Date: Mon Jul 29 14:03:42 2013 New Revision: 1508074 URL: http://svn.apache.org/r1508074 Log: link to example config Modified: sling/site/trunk/content/documentation/bundles/sling-health-check-tool.mdtext Modified: sling/site/trunk/content/documentation/bundles/sling-health-check-tool.mdtext URL: http://svn.apache.org/viewvc/sling/site/trunk/content/documentation/bundles/sling-health-check-tool.mdtext?rev=1508074r1=1508073r2=1508074view=diff == --- sling/site/trunk/content/documentation/bundles/sling-health-check-tool.mdtext (original) +++ sling/site/trunk/content/documentation/bundles/sling-health-check-tool.mdtext Mon Jul 29 14:03:42 2013 @@ -64,7 +64,7 @@ that Sling supports, selected by an exte Creating _org.apache.sling.hc.sling.impl.RulesMBeans_ OSGi configurations causes the results of health check rules to be made available via JMX MBeans in the _org.apache.sling.healthcheck_ JMX tree. -The slingdemo module provides an example configuration, which is used in the screenshot below. +The slingdemo module provides an [example configuration][2], which is used in the screenshot below. To create such a configuration you need to specify the root path where rule definitions are found in the repository, an optional MBean name that's used to name this set of rules below the @@ -81,4 +81,5 @@ data is read-only. ## Known issues See [SLING-2822](https://issues.apache.org/jira/browse/SLING-2822) for details. - [1]: http://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/healthcheck/sling-demo/src/main/resources/SLING-CONTENT/apps/hc/demo \ No newline at end of file + [1]: http://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/healthcheck/sling-demo/src/main/resources/SLING-CONTENT/apps/hc/demo + [2]: http://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/healthcheck/sling-demo/src/main/resources/SLING-CONTENT/apps/hc/install/org.apache.sling.hc.sling.impl.RulesMBeans-1.json \ No newline at end of file
svn commit: r871714 - in /websites/staging/sling/trunk/content: ./ documentation/bundles/sling-health-check-tool.html
Author: buildbot Date: Mon Jul 29 14:03:48 2013 New Revision: 871714 Log: Staging update by buildbot for sling Modified: websites/staging/sling/trunk/content/ (props changed) websites/staging/sling/trunk/content/documentation/bundles/sling-health-check-tool.html Propchange: websites/staging/sling/trunk/content/ -- --- cms:source-revision (original) +++ cms:source-revision Mon Jul 29 14:03:48 2013 @@ -1 +1 @@ -1508073 +1508074 Modified: websites/staging/sling/trunk/content/documentation/bundles/sling-health-check-tool.html == --- websites/staging/sling/trunk/content/documentation/bundles/sling-health-check-tool.html (original) +++ websites/staging/sling/trunk/content/documentation/bundles/sling-health-check-tool.html Mon Jul 29 14:03:48 2013 @@ -136,7 +136,7 @@ that Sling supports, selected by an exte h3 id=jmx-access-to-health-check-rules-resultsJMX access to Health Check Rules results/h3 pCreating emorg.apache.sling.hc.sling.impl.RulesMBeans/em OSGi configurations causes the results of health check rules to be made available via JMX MBeans in the emorg.apache.sling.healthcheck/em JMX tree./p -pThe slingdemo module provides an example configuration, which is used in the screenshot below./p +pThe slingdemo module provides an a href=http://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/healthcheck/sling-demo/src/main/resources/SLING-CONTENT/apps/hc/install/org.apache.sling.hc.sling.impl.RulesMBeans-1.json;example configuration/a, which is used in the screenshot below./p pTo create such a configuration you need to specify the root path where rule definitions are found in the repository, an optional MBean name that's used to name this set of rules below the emorg.apache.sling.healthcheck/em JMX tree root, and an optional set of rules tags to select which rules @@ -148,7 +148,7 @@ data is read-only./p h2 id=known-issuesKnown issues/h2 pSee a href=https://issues.apache.org/jira/browse/SLING-2822;SLING-2822/a for details./p div class=timestamp style=margin-top: 30px; font-size: 80%; text-align: right; -Rev. 1508073 by bdelacretaz on Mon, 29 Jul 2013 14:01:25 + +Rev. 1508074 by bdelacretaz on Mon, 29 Jul 2013 14:03:42 + /div div class=trademarkFooter Apache Sling, Sling, Apache, the Apache feather logo, and the Apache Sling project
svn commit: r1508078 - /sling/trunk/bundles/commons/scheduler/pom.xml
Author: cziegeler Date: Mon Jul 29 14:21:33 2013 New Revision: 1508078 URL: http://svn.apache.org/r1508078 Log: Add missing version information for dynamic package import Modified: sling/trunk/bundles/commons/scheduler/pom.xml Modified: sling/trunk/bundles/commons/scheduler/pom.xml URL: http://svn.apache.org/viewvc/sling/trunk/bundles/commons/scheduler/pom.xml?rev=1508078r1=1508077r2=1508078view=diff == --- sling/trunk/bundles/commons/scheduler/pom.xml (original) +++ sling/trunk/bundles/commons/scheduler/pom.xml Mon Jul 29 14:21:33 2013 @@ -58,7 +58,7 @@ org.apache.sling.commons.scheduler.impl /Private-Package DynamicImport-Package -org.apache.sling.discovery, +org.apache.sling.discovery;version=[1.0,2), commonj.work, com.mchange.v2.c3p0, javax.ejb,
svn commit: r1508081 - in /sling/trunk/contrib/extensions/healthcheck/hc-rules/src: main/java/org/apache/sling/hc/rules/scriptable/ test/java/org/apache/sling/hc/rules/impl/
Author: bdelacretaz Date: Mon Jul 29 14:32:26 2013 New Revision: 1508081 URL: http://svn.apache.org/r1508081 Log: SLING-2983 - jmx binding for easy access to jmx attributes in scripted rules Added: sling/trunk/contrib/extensions/healthcheck/hc-rules/src/main/java/org/apache/sling/hc/rules/scriptable/JmxBinding.java Modified: sling/trunk/contrib/extensions/healthcheck/hc-rules/src/main/java/org/apache/sling/hc/rules/scriptable/ScriptableRuleBuilder.java sling/trunk/contrib/extensions/healthcheck/hc-rules/src/test/java/org/apache/sling/hc/rules/impl/ScriptableRuleBuilderTest.java Added: sling/trunk/contrib/extensions/healthcheck/hc-rules/src/main/java/org/apache/sling/hc/rules/scriptable/JmxBinding.java URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/healthcheck/hc-rules/src/main/java/org/apache/sling/hc/rules/scriptable/JmxBinding.java?rev=1508081view=auto == --- sling/trunk/contrib/extensions/healthcheck/hc-rules/src/main/java/org/apache/sling/hc/rules/scriptable/JmxBinding.java (added) +++ sling/trunk/contrib/extensions/healthcheck/hc-rules/src/main/java/org/apache/sling/hc/rules/scriptable/JmxBinding.java Mon Jul 29 14:32:26 2013 @@ -0,0 +1,57 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The SF licenses this file + * to you under the Apache License, Version 2.0 (the + * License); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.sling.hc.rules.scriptable; + +import java.lang.management.ManagementFactory; + +import javax.management.AttributeNotFoundException; +import javax.management.InstanceNotFoundException; +import javax.management.MBeanException; +import javax.management.MBeanServer; +import javax.management.MalformedObjectNameException; +import javax.management.ObjectName; +import javax.management.ReflectionException; + +import org.slf4j.Logger; + +/** The JmxBinding is meant to be bound as jmx global variables + * in scripted rules, to allow for writing scripted expressions + * like jmx.attribute(java.lang:type=ClassLoading, LoadedClassCount) 100 + */ +public class JmxBinding { +private MBeanServer jmxServer = ManagementFactory.getPlatformMBeanServer(); +private final Logger logger; + +JmxBinding(Logger logger) { +this.logger = logger; +} + +public Object attribute(String objectNameString, String attributeName) +throws MalformedObjectNameException, AttributeNotFoundException, InstanceNotFoundException, MBeanException, ReflectionException { +final ObjectName name = new ObjectName(objectNameString); +if(jmxServer.queryNames(name, null).size() == 0) { +final String msg = JMX object name not found: [ + objectNameString + ]; +logger.warn(msg); +throw new IllegalStateException(msg); +} +logger.debug(Got JMX Object [{}], name); +final Object value = jmxServer.getAttribute(name, attributeName); +logger.debug(JMX Object [{}] Attribute [{}] = [{}], new Object[] { name, attributeName, value }); +return value; +} +} \ No newline at end of file Modified: sling/trunk/contrib/extensions/healthcheck/hc-rules/src/main/java/org/apache/sling/hc/rules/scriptable/ScriptableRuleBuilder.java URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/healthcheck/hc-rules/src/main/java/org/apache/sling/hc/rules/scriptable/ScriptableRuleBuilder.java?rev=1508081r1=1508080r2=1508081view=diff == --- sling/trunk/contrib/extensions/healthcheck/hc-rules/src/main/java/org/apache/sling/hc/rules/scriptable/ScriptableRuleBuilder.java (original) +++ sling/trunk/contrib/extensions/healthcheck/hc-rules/src/main/java/org/apache/sling/hc/rules/scriptable/ScriptableRuleBuilder.java Mon Jul 29 14:32:26 2013 @@ -17,6 +17,7 @@ */ package org.apache.sling.hc.rules.scriptable; +import javax.script.Bindings; import javax.script.ScriptEngine; import javax.script.ScriptEngineManager; import javax.script.ScriptException; @@ -83,9 +84,11 @@ public class ScriptableRuleBuilder imple logger.error(Cannot evaluate: {}, scriptEngineMsg); } else { try { -return scriptEngine.eval(expression); +
svn commit: r1508099 - in /sling/trunk/contrib/launchpad/karaf: ./ org.apache.sling.launchpad.karaf-features/ org.apache.sling.launchpad.karaf-features/src/main/feature/ org.apache.sling.launchpad.kar
Author: rombert Date: Mon Jul 29 15:29:37 2013 New Revision: 1508099 URL: http://svn.apache.org/r1508099 Log: SLING-2789 - deploying Sling 7-SNAPSHOT on Karaf fails Applied patch SLING-2789.2013-07-25.a.patch from Oliver Lietz. - removed 'BUILD' component from versions - misc version updates Modified: sling/trunk/contrib/launchpad/karaf/README.txt sling/trunk/contrib/launchpad/karaf/org.apache.sling.launchpad.karaf-features/pom.xml sling/trunk/contrib/launchpad/karaf/org.apache.sling.launchpad.karaf-features/src/main/feature/feature.xml sling/trunk/contrib/launchpad/karaf/org.apache.sling.launchpad.karaf-integration-tests/pom.xml sling/trunk/contrib/launchpad/karaf/org.apache.sling.launchpad.karaf-integration-tests/src/test/java/org/apache/sling/launchpad/karaf/BootstrapTest.java sling/trunk/contrib/launchpad/karaf/org.apache.sling.launchpad.karaf/pom.xml sling/trunk/contrib/launchpad/karaf/pom.xml Modified: sling/trunk/contrib/launchpad/karaf/README.txt URL: http://svn.apache.org/viewvc/sling/trunk/contrib/launchpad/karaf/README.txt?rev=1508099r1=1508098r2=1508099view=diff == --- sling/trunk/contrib/launchpad/karaf/README.txt (original) +++ sling/trunk/contrib/launchpad/karaf/README.txt Mon Jul 29 15:29:37 2013 @@ -39,7 +39,7 @@ How to deploy this 2) Add the Apache Sling features repository and install: - karaf@root() feature:repo-add mvn:org.apache.sling/org.apache.sling.launchpad.karaf-features/0.1.0.BUILD-SNAPSHOT/xml/features + karaf@root() feature:repo-add mvn:org.apache.sling/org.apache.sling.launchpad.karaf-features/0.1.0-SNAPSHOT/xml/features karaf@root() feature:install sling-karaf 3) Install Launchpad content and Explorer: Modified: sling/trunk/contrib/launchpad/karaf/org.apache.sling.launchpad.karaf-features/pom.xml URL: http://svn.apache.org/viewvc/sling/trunk/contrib/launchpad/karaf/org.apache.sling.launchpad.karaf-features/pom.xml?rev=1508099r1=1508098r2=1508099view=diff == --- sling/trunk/contrib/launchpad/karaf/org.apache.sling.launchpad.karaf-features/pom.xml (original) +++ sling/trunk/contrib/launchpad/karaf/org.apache.sling.launchpad.karaf-features/pom.xml Mon Jul 29 15:29:37 2013 @@ -24,12 +24,12 @@ parent groupIdorg.apache.sling/groupId artifactIdsling/artifactId -version16/version +version17/version relativePath../../../../parent/pom.xml/relativePath /parent artifactIdorg.apache.sling.launchpad.karaf-features/artifactId - version0.1.0.BUILD-SNAPSHOT/version + version0.1.0-SNAPSHOT/version packagingfeature/packaging nameApache Sling Launchpad Karaf - Features/name Modified: sling/trunk/contrib/launchpad/karaf/org.apache.sling.launchpad.karaf-features/src/main/feature/feature.xml URL: http://svn.apache.org/viewvc/sling/trunk/contrib/launchpad/karaf/org.apache.sling.launchpad.karaf-features/src/main/feature/feature.xml?rev=1508099r1=1508098r2=1508099view=diff == --- sling/trunk/contrib/launchpad/karaf/org.apache.sling.launchpad.karaf-features/src/main/feature/feature.xml (original) +++ sling/trunk/contrib/launchpad/karaf/org.apache.sling.launchpad.karaf-features/src/main/feature/feature.xml Mon Jul 29 15:29:37 2013 @@ -1,6 +1,6 @@ ?xml version=1.0 encoding=UTF-8? features name=sling-launchpad-karaf xmlns=http://karaf.apache.org/xmlns/features/v1.2.0; - feature name=sling-karaf-requirements version=0.1.0.BUILD-SNAPSHOT + feature name=sling-karaf-requirements version=${project.version} !-- features (some are part of Karaf's defaults)-- featureconfig/feature featureeventadmin/feature @@ -31,7 +31,7 @@ bundle dependency=truemvn:org.apache.felix/org.apache.felix.webconsole.plugins.memoryusage/1.0.4/bundle bundle dependency=truemvn:org.apache.felix/org.apache.felix.webconsole.plugins.packageadmin/1.0.0/bundle /feature - feature name=sling-karaf version=0.1.0.BUILD-SNAPSHOT + feature name=sling-karaf version=${project.version} featuresling-karaf-requirements/feature !-- Apache Commons -- bundle dependency=truemvn:commons-codec/commons-codec/1.6/bundle @@ -87,12 +87,12 @@ bundlemvn:org.apache.sling/org.apache.sling.installer.provider.jcr/3.1.6/bundle !-- Apache Sling Launchpad -- bundlemvn:org.apache.sling/org.apache.sling.launchpad.api/1.1.0/bundle - bundlemvn:org.apache.sling/org.apache.sling.launchpad.karaf/0.1.0.BUILD-SNAPSHOT/bundle + bundlemvn:org.apache.sling/org.apache.sling.launchpad.karaf/${project.version}/bundle !-- Apache Sling JCR -- bundlemvn:org.apache.sling/org.apache.sling.jcr.api/2.1.0/bundle bundlemvn:org.apache.sling/org.apache.sling.jcr.base/2.1.2/bundle bundlemvn:org.apache.sling/org.apache.sling.jcr.classloader/3.1.12/bundle -
svn commit: r1508100 - /sling/trunk/contrib/pom.xml
Author: rombert Date: Mon Jul 29 15:29:50 2013 New Revision: 1508100 URL: http://svn.apache.org/r1508100 Log: SLING-2789 - deploying Sling 7-SNAPSHOT on Karaf fails Re-added the launchpad/karaf module to the contrib reactor. Modified: sling/trunk/contrib/pom.xml Modified: sling/trunk/contrib/pom.xml URL: http://svn.apache.org/viewvc/sling/trunk/contrib/pom.xml?rev=1508100r1=1508099r2=1508100view=diff == --- sling/trunk/contrib/pom.xml (original) +++ sling/trunk/contrib/pom.xml Mon Jul 29 15:29:50 2013 @@ -103,9 +103,7 @@ modulejcr/jackrabbit-client/module modulejcr/compiler/module modulejcr/prefs/module - !-- modulelaunchpad/karaf/module - -- modulelaunchpad/testing/module modulescripting/script-console/module modulescripting/jsp-taglib-atom/module