You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by gh...@apache.org on 2020/03/27 16:30:10 UTC

[felix-dev] 01/01: FELIX-6245 Condition service interfaces to by used together with HealthCheckMonitor

This is an automated email from the ASF dual-hosted git repository.

ghenzler pushed a commit to branch feature/FELIX-6245-condition-service-interfaces
in repository https://gitbox.apache.org/repos/asf/felix-dev.git

commit 20678838ec896780940a643bdd3a0837e58c09ae
Author: georg.henzler <ge...@netcentric.biz>
AuthorDate: Fri Mar 27 17:28:31 2020 +0100

    FELIX-6245 Condition service interfaces to by used together with
    HealthCheckMonitor
---
 .../org/apache/felix/hc/api/condition/Healthy.java | 41 ++++++++++++++++++++++
 .../apache/felix/hc/api/condition/SystemReady.java | 38 ++++++++++++++++++++
 .../apache/felix/hc/api/condition/Unhealthy.java   | 29 +++++++++++++++
 .../felix/hc/api/condition/package-info.java       | 30 ++++++++++++++++
 4 files changed, 138 insertions(+)

diff --git a/healthcheck/api/src/main/java/org/apache/felix/hc/api/condition/Healthy.java b/healthcheck/api/src/main/java/org/apache/felix/hc/api/condition/Healthy.java
new file mode 100644
index 0000000..3f65984
--- /dev/null
+++ b/healthcheck/api/src/main/java/org/apache/felix/hc/api/condition/Healthy.java
@@ -0,0 +1,41 @@
+/*
+ * 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 ASF 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.felix.hc.api.condition;
+
+/**
+ * Marker service that other services can depend on to automatically 
+ * activate/deactivate based on a certain health status.
+ * 
+ * To activate a component only upon healthiness of a certain tag/name:
+ * 
+ * <pre>
+ * 	&#64;Reference(target="(tag=systemready)")
+ * 	Healthy healthy;
+ * 
+ * 	&#64;Reference(target="(name=My Health Check)")
+ * 	Healthy healthy;
+ * </pre>
+ * 
+ * For this to work, the PID {@code org.apache.felix.hc.core.impl.monitor.HealthCheckMonitor} needs to configured 
+ * for given tag/name.
+ * 
+ */
+public interface Healthy {
+
+}
diff --git a/healthcheck/api/src/main/java/org/apache/felix/hc/api/condition/SystemReady.java b/healthcheck/api/src/main/java/org/apache/felix/hc/api/condition/SystemReady.java
new file mode 100644
index 0000000..295851c
--- /dev/null
+++ b/healthcheck/api/src/main/java/org/apache/felix/hc/api/condition/SystemReady.java
@@ -0,0 +1,38 @@
+/*
+ * 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 ASF 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.felix.hc.api.condition;
+
+/**
+ * Special marker service for tag "systemready" that by convention that can be used as follows:
+ * 
+ * <pre>
+ * 	&#64;Reference
+ * 	SystemReady systemReady;
+ *  
+ * 
+ * 	&#64;Reference(target="(tag=systemready)")  // same as SystemReady above
+ * 	Healthy healthy; 
+ * </pre>
+ * 
+ * Same as for Healthy, the PID {@code org.apache.felix.hc.core.impl.monitor.HealthCheckMonitor} 
+ * needs to configured for the tag "systemready" for this to work.
+ */
+public interface SystemReady extends Healthy {
+
+}
diff --git a/healthcheck/api/src/main/java/org/apache/felix/hc/api/condition/Unhealthy.java b/healthcheck/api/src/main/java/org/apache/felix/hc/api/condition/Unhealthy.java
new file mode 100644
index 0000000..7594e29
--- /dev/null
+++ b/healthcheck/api/src/main/java/org/apache/felix/hc/api/condition/Unhealthy.java
@@ -0,0 +1,29 @@
+/*
+ * 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 ASF 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.felix.hc.api.condition;
+
+/**
+ * Marker service that other services can depend on to automatically 
+ * activate/deactivate based on a certain health status.
+ * 
+ * This is the inverse status of {@link Healthy}.
+ */
+public interface Unhealthy {
+
+}
diff --git a/healthcheck/api/src/main/java/org/apache/felix/hc/api/condition/package-info.java b/healthcheck/api/src/main/java/org/apache/felix/hc/api/condition/package-info.java
new file mode 100644
index 0000000..8a4e51b
--- /dev/null
+++ b/healthcheck/api/src/main/java/org/apache/felix/hc/api/condition/package-info.java
@@ -0,0 +1,30 @@
+/*
+ * 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 ASF 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.
+ */
+
+/**
+ * Marker services that allow to automatically activate/deactivate 
+ * components based on health status.
+ * 
+ * The HealthCheckMonitor with PID {@code org.apache.felix.hc.core.impl.monitor.HealthCheckMonitor} 
+ * needs to configured for the marker services to work.
+ */
+@Version("1.0.0")
+package org.apache.felix.hc.api.condition;
+
+import org.osgi.annotation.versioning.Version;