svn commit: r1557124 - in /sling/trunk/bundles/extensions/healthcheck/core/src: main/java/org/apache/sling/hc/jmx/ main/java/org/apache/sling/hc/jmx/impl/ test/java/org/apache/sling/hc/jmx/ test/java/

2014-01-10 Thread cziegeler
Author: cziegeler
Date: Fri Jan 10 14:02:01 2014
New Revision: 1557124

URL: http://svn.apache.org/r1557124
Log:
SLING-3312 : Move JMX bean registration into core module

Added:

sling/trunk/bundles/extensions/healthcheck/core/src/main/java/org/apache/sling/hc/jmx/

sling/trunk/bundles/extensions/healthcheck/core/src/main/java/org/apache/sling/hc/jmx/impl/

sling/trunk/bundles/extensions/healthcheck/core/src/main/java/org/apache/sling/hc/jmx/impl/HealthCheckMBean.java
   (with props)

sling/trunk/bundles/extensions/healthcheck/core/src/main/java/org/apache/sling/hc/jmx/impl/HealthCheckMBeanCreator.java
   (with props)

sling/trunk/bundles/extensions/healthcheck/core/src/test/java/org/apache/sling/hc/jmx/

sling/trunk/bundles/extensions/healthcheck/core/src/test/java/org/apache/sling/hc/jmx/impl/

sling/trunk/bundles/extensions/healthcheck/core/src/test/java/org/apache/sling/hc/jmx/impl/HealthCheckMBeanTest.java
   (with props)

Added: 
sling/trunk/bundles/extensions/healthcheck/core/src/main/java/org/apache/sling/hc/jmx/impl/HealthCheckMBean.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/healthcheck/core/src/main/java/org/apache/sling/hc/jmx/impl/HealthCheckMBean.java?rev=1557124view=auto
==
--- 
sling/trunk/bundles/extensions/healthcheck/core/src/main/java/org/apache/sling/hc/jmx/impl/HealthCheckMBean.java
 (added)
+++ 
sling/trunk/bundles/extensions/healthcheck/core/src/main/java/org/apache/sling/hc/jmx/impl/HealthCheckMBean.java
 Fri Jan 10 14:02:01 2014
@@ -0,0 +1,261 @@
+/*
+ * 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.jmx.impl;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.management.Attribute;
+import javax.management.AttributeList;
+import javax.management.AttributeNotFoundException;
+import javax.management.DynamicMBean;
+import javax.management.InvalidAttributeValueException;
+import javax.management.MBeanAttributeInfo;
+import javax.management.MBeanException;
+import javax.management.MBeanInfo;
+import javax.management.ReflectionException;
+import javax.management.openmbean.CompositeDataSupport;
+import javax.management.openmbean.CompositeType;
+import javax.management.openmbean.OpenDataException;
+import javax.management.openmbean.OpenMBeanAttributeInfoSupport;
+import javax.management.openmbean.OpenType;
+import javax.management.openmbean.SimpleType;
+import javax.management.openmbean.TabularData;
+import javax.management.openmbean.TabularDataSupport;
+import javax.management.openmbean.TabularType;
+
+import org.apache.sling.hc.api.HealthCheck;
+import org.apache.sling.hc.api.Result;
+import org.apache.sling.hc.api.ResultLog;
+import org.osgi.framework.Constants;
+import org.osgi.framework.ServiceReference;
+
+/** A {@link DynamicMBean} used to execute a {@link HealthCheck} service */
+public class HealthCheckMBean implements DynamicMBean {
+
+/** A HC result is cached for this time (ms) */
+private static final long RESULT_TTL = 1500;
+
+public static final String HC_OK_ATTRIBUTE_NAME = ok;
+public static final String HC_STATUS_ATTRIBUTE_NAME = status;
+public static final String HC_LOG_ATTRIBUTE_NAME = log;
+
+private static CompositeType LOG_ROW_TYPE;
+private static TabularType LOG_TABLE_TYPE;
+
+public static final String INDEX_COLUMN = index;
+public static final String LEVEL_COLUMN = level;
+public static final String MESSAGE_COLUMN = message;
+
+public static final String JMX_TYPE_NAME = HealthCheck;
+public static final String JMX_DOMAIN = org.apache.sling.healthcheck;
+
+/** The health check service to call. */
+private final HealthCheck healthCheck;
+
+/** The mbean info. */
+private final MBeanInfo mbeanInfo;
+
+/** The default attributes. */
+private final MapString, Object defaultAttributes;
+
+private long healthCheckInvocationTime;
+
+private Result healthCheckResult;
+
+static {
+try {
+// Define the log row and table types
+LOG_ROW_TYPE = new CompositeType(

svn commit: r1557125 - in /sling/trunk/bundles/extensions/healthcheck: jmx/ pom.xml

2014-01-10 Thread cziegeler
Author: cziegeler
Date: Fri Jan 10 14:02:48 2014
New Revision: 1557125

URL: http://svn.apache.org/r1557125
Log:
SLING-3312 : Move JMX bean registration into core module

Removed:
sling/trunk/bundles/extensions/healthcheck/jmx/
Modified:
sling/trunk/bundles/extensions/healthcheck/pom.xml

Modified: sling/trunk/bundles/extensions/healthcheck/pom.xml
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/healthcheck/pom.xml?rev=1557125r1=1557124r2=1557125view=diff
==
--- sling/trunk/bundles/extensions/healthcheck/pom.xml (original)
+++ sling/trunk/bundles/extensions/healthcheck/pom.xml Fri Jan 10 14:02:48 2014
@@ -32,7 +32,6 @@
 modulecore/module
 modulesamples/module
 modulesupport/module
-modulejmx/module
 modulewebconsole/module
 moduleit/module
 /modules




svn commit: r1557138 - in /sling/trunk/bundles/extensions/healthcheck: core/src/main/java/org/apache/sling/hc/api/execution/ core/src/main/java/org/apache/sling/hc/core/impl/executor/ core/src/main/ja

2014-01-10 Thread cziegeler
Author: cziegeler
Date: Fri Jan 10 14:44:31 2014
New Revision: 1557138

URL: http://svn.apache.org/r1557138
Log:
SLING-3278 : Provide a HealthCheckExecutor service. Change API to execute 
checks based on tags, add service reference to HealthCheckMetadata

Removed:

sling/trunk/bundles/extensions/healthcheck/core/src/main/java/org/apache/sling/hc/core/impl/executor/HealthCheckDescriptor.java
Modified:

sling/trunk/bundles/extensions/healthcheck/core/src/main/java/org/apache/sling/hc/api/execution/HealthCheckExecutionResult.java

sling/trunk/bundles/extensions/healthcheck/core/src/main/java/org/apache/sling/hc/api/execution/HealthCheckExecutor.java

sling/trunk/bundles/extensions/healthcheck/core/src/main/java/org/apache/sling/hc/core/impl/executor/ExecutionResult.java

sling/trunk/bundles/extensions/healthcheck/core/src/main/java/org/apache/sling/hc/core/impl/executor/HealthCheckExecutorImpl.java

sling/trunk/bundles/extensions/healthcheck/core/src/main/java/org/apache/sling/hc/core/impl/executor/HealthCheckFuture.java

sling/trunk/bundles/extensions/healthcheck/core/src/main/java/org/apache/sling/hc/core/impl/executor/HealthCheckResultCache.java

sling/trunk/bundles/extensions/healthcheck/core/src/main/java/org/apache/sling/hc/util/HealthCheckMetadata.java

sling/trunk/bundles/extensions/healthcheck/core/src/test/java/org/apache/sling/hc/core/impl/executor/HealthCheckExecutorImplTest.java

sling/trunk/bundles/extensions/healthcheck/webconsole/src/main/java/org/apache/sling/hc/webconsole/impl/HealthCheckWebconsolePlugin.java

Modified: 
sling/trunk/bundles/extensions/healthcheck/core/src/main/java/org/apache/sling/hc/api/execution/HealthCheckExecutionResult.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/healthcheck/core/src/main/java/org/apache/sling/hc/api/execution/HealthCheckExecutionResult.java?rev=1557138r1=1557137r2=1557138view=diff
==
--- 
sling/trunk/bundles/extensions/healthcheck/core/src/main/java/org/apache/sling/hc/api/execution/HealthCheckExecutionResult.java
 (original)
+++ 
sling/trunk/bundles/extensions/healthcheck/core/src/main/java/org/apache/sling/hc/api/execution/HealthCheckExecutionResult.java
 Fri Jan 10 14:44:31 2014
@@ -8,8 +8,7 @@ import org.apache.sling.hc.util.HealthCh
 import aQute.bnd.annotation.ProviderType;
 
 /**
- * Interface for health check results.
- *
+ * Interface for health check executions via the {@link HealthCheckExecutor}.
  */
 @ProviderType
 public interface HealthCheckExecutionResult {
@@ -19,8 +18,14 @@ public interface HealthCheckExecutionRes
  */
 Result getHealthCheckResult();
 
+/**
+ * Get the elapsed time in ms
+ */
 long getElapsedTimeInMs();
 
+/**
+ * Get the date, the health check finished.
+ */
 Date getFinishedAt();
 
 /**

Modified: 
sling/trunk/bundles/extensions/healthcheck/core/src/main/java/org/apache/sling/hc/api/execution/HealthCheckExecutor.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/healthcheck/core/src/main/java/org/apache/sling/hc/api/execution/HealthCheckExecutor.java?rev=1557138r1=1557137r2=1557138view=diff
==
--- 
sling/trunk/bundles/extensions/healthcheck/core/src/main/java/org/apache/sling/hc/api/execution/HealthCheckExecutor.java
 (original)
+++ 
sling/trunk/bundles/extensions/healthcheck/core/src/main/java/org/apache/sling/hc/api/execution/HealthCheckExecutor.java
 Fri Jan 10 14:44:31 2014
@@ -20,7 +20,6 @@ package org.apache.sling.hc.api.executio
 import java.util.List;
 
 import org.apache.sling.hc.api.HealthCheck;
-import org.osgi.framework.ServiceReference;
 
 import aQute.bnd.annotation.ProviderType;
 
@@ -33,9 +32,10 @@ import aQute.bnd.annotation.ProviderType
 public interface HealthCheckExecutor {
 
 /**
- * Executes all health checks
+ * Executes all health checks with the supplied list of tags.
+ * If no tags are supplied, all health checks are executed.
  *
  * @return List of results. The list might be empty.
  */
-ListHealthCheckExecutionResult execute(ServiceReference... 
healthCheckReferences);
+ListHealthCheckExecutionResult execute(String... tags);
 }
\ No newline at end of file

Modified: 
sling/trunk/bundles/extensions/healthcheck/core/src/main/java/org/apache/sling/hc/core/impl/executor/ExecutionResult.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/healthcheck/core/src/main/java/org/apache/sling/hc/core/impl/executor/ExecutionResult.java?rev=1557138r1=1557137r2=1557138view=diff
==
--- 
sling/trunk/bundles/extensions/healthcheck/core/src/main/java/org/apache/sling/hc/core/impl/executor/ExecutionResult.java
 (original)
+++ 

svn commit: r1557176 - in /sling/trunk/bundles/extensions/healthcheck/core/src: main/java/org/apache/sling/hc/core/impl/executor/ main/java/org/apache/sling/hc/jmx/impl/ test/java/org/apache/sling/hc/

2014-01-10 Thread cziegeler
Author: cziegeler
Date: Fri Jan 10 16:14:16 2014
New Revision: 1557176

URL: http://svn.apache.org/r1557176
Log:
SLING-3278 : Provide a HealthCheckExecutor service. Use executor for jmx mbean 
execution

Added:

sling/trunk/bundles/extensions/healthcheck/core/src/main/java/org/apache/sling/hc/core/impl/executor/ExtendedHealthCheckExecutor.java
   (with props)
Modified:

sling/trunk/bundles/extensions/healthcheck/core/src/main/java/org/apache/sling/hc/core/impl/executor/HealthCheckExecutorImpl.java

sling/trunk/bundles/extensions/healthcheck/core/src/main/java/org/apache/sling/hc/jmx/impl/HealthCheckMBean.java

sling/trunk/bundles/extensions/healthcheck/core/src/main/java/org/apache/sling/hc/jmx/impl/HealthCheckMBeanCreator.java

sling/trunk/bundles/extensions/healthcheck/core/src/test/java/org/apache/sling/hc/jmx/impl/HealthCheckMBeanTest.java

Added: 
sling/trunk/bundles/extensions/healthcheck/core/src/main/java/org/apache/sling/hc/core/impl/executor/ExtendedHealthCheckExecutor.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/healthcheck/core/src/main/java/org/apache/sling/hc/core/impl/executor/ExtendedHealthCheckExecutor.java?rev=1557176view=auto
==
--- 
sling/trunk/bundles/extensions/healthcheck/core/src/main/java/org/apache/sling/hc/core/impl/executor/ExtendedHealthCheckExecutor.java
 (added)
+++ 
sling/trunk/bundles/extensions/healthcheck/core/src/main/java/org/apache/sling/hc/core/impl/executor/ExtendedHealthCheckExecutor.java
 Fri Jan 10 16:14:16 2014
@@ -0,0 +1,31 @@
+/*
+ * 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.core.impl.executor;
+
+import org.apache.sling.hc.api.execution.HealthCheckExecutionResult;
+import org.apache.sling.hc.api.execution.HealthCheckExecutor;
+import org.osgi.framework.ServiceReference;
+
+/**
+ * Internal service used by the JMX stuff
+ *
+ */
+public interface ExtendedHealthCheckExecutor extends HealthCheckExecutor {
+
+HealthCheckExecutionResult execute(ServiceReference ref);
+}
\ No newline at end of file

Propchange: 
sling/trunk/bundles/extensions/healthcheck/core/src/main/java/org/apache/sling/hc/core/impl/executor/ExtendedHealthCheckExecutor.java
--
svn:eol-style = native

Propchange: 
sling/trunk/bundles/extensions/healthcheck/core/src/main/java/org/apache/sling/hc/core/impl/executor/ExtendedHealthCheckExecutor.java
--
svn:keywords = author date id revision rev url

Propchange: 
sling/trunk/bundles/extensions/healthcheck/core/src/main/java/org/apache/sling/hc/core/impl/executor/ExtendedHealthCheckExecutor.java
--
svn:mime-type = text/plain

Modified: 
sling/trunk/bundles/extensions/healthcheck/core/src/main/java/org/apache/sling/hc/core/impl/executor/HealthCheckExecutorImpl.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/healthcheck/core/src/main/java/org/apache/sling/hc/core/impl/executor/HealthCheckExecutorImpl.java?rev=1557176r1=1557175r2=1557176view=diff
==
--- 
sling/trunk/bundles/extensions/healthcheck/core/src/main/java/org/apache/sling/hc/core/impl/executor/HealthCheckExecutorImpl.java
 (original)
+++ 
sling/trunk/bundles/extensions/healthcheck/core/src/main/java/org/apache/sling/hc/core/impl/executor/HealthCheckExecutorImpl.java
 Fri Jan 10 16:14:16 2014
@@ -36,6 +36,7 @@ import org.apache.commons.lang.time.Stop
 import org.apache.felix.scr.annotations.Activate;
 import org.apache.felix.scr.annotations.Component;
 import org.apache.felix.scr.annotations.Deactivate;
+import org.apache.felix.scr.annotations.Modified;
 import org.apache.felix.scr.annotations.Property;
 import org.apache.felix.scr.annotations.Reference;
 import org.apache.felix.scr.annotations.Service;
@@ -57,11 +58,11 @@ import org.slf4j.LoggerFactory;
  * Runs health checks for a given list of tags in parallel.
  *
  */
-@Service(value = 

[CONF] Apache Sling Proxy Server Resource Provider

2014-01-10 Thread Justin Edelson (Confluence)














  


Justin Edelson added a comment to the page:
 


Proxy Server Resource Provider   





Looks interesting. Some things to consider:

Security - what if the target requires authentication?
Caching - can we cache the target resources using some configurable TTL?

I'm not sure about the ResourceProvider definitions being in the repository. Shouldn't these just be factory components?





 View Online   Like  
 Stop watching space   Manage Notifications  


 


 


  This message was sent by Atlassian Confluence 5.0.3, Team Collaboration Software  






[CONF] Apache Sling Proxy Server Resource Provider

2014-01-10 Thread Felix Meschberger (Confluence)














  


Felix Meschberger hat Seite einen Kommentar hinzugefgt
 


Proxy Server Resource Provider   





Right Security would have to be considered (not really eager to store credentials in the repository, though). And caching certainly is one optimization we have to do.
Having factory configuration would certainly make it easier to update etc. Having it in the repository would indicate the root node in the repository where this hangs out. Yet, of course, we could as well generate such a marker node on demand when the configuration is created.


Als Antwort auf einen Kommentar von Justin Edelson :

Looks interesting. Some things to consider:

Security - what if the target requires authentication?
Caching - can we cache the target resources using some configurable TTL?

I'm not sure about the ResourceProvider definitions being in the repository. Shouldn't these just be factory components?






 Online anzeigen   Gefllt mir  
 berwachung des Bereichs beenden   Benachrichtigungen verwalten  


 


 


  Diese Nachricht wurde von Atlassian Confluence 5.0.3, der Kollaborationssoftware fr Teams, gesendet