You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/11/07 09:36:53 UTC
[sling-org-apache-sling-hc-api] 03/05: Use parent pom 30,
OSGi annotations, clean up
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.hc.api-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-api.git
commit 3dc27fc5e18ff10ce74125919e2ccc7038d98967
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Thu Apr 27 08:26:45 2017 +0000
Use parent pom 30, OSGi annotations, clean up
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/healthcheck/api@1792850 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 20 ++++------------
.../java/org/apache/sling/hc/api/HealthCheck.java | 7 +++---
.../api/execution/HealthCheckExecutionResult.java | 2 +-
.../hc/api/execution/HealthCheckExecutor.java | 4 ++--
.../sling/hc/api/execution/package-info.java | 3 +--
.../java/org/apache/sling/hc/api/package-info.java | 3 +--
.../apache/sling/hc/util/HealthCheckMetadata.java | 27 ++++++++++++++--------
.../org/apache/sling/hc/util/package-info.java | 3 +--
8 files changed, 30 insertions(+), 39 deletions(-)
diff --git a/pom.xml b/pom.xml
index 35ad1bb..9d88e9c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -21,9 +21,10 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
- <artifactId>org.apache.sling.hc.reactor</artifactId>
<groupId>org.apache.sling</groupId>
- <version>1.0.3-SNAPSHOT</version>
+ <artifactId>sling</artifactId>
+ <version>30</version>
+ <relativePath />
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -58,24 +59,11 @@
<dependencies>
<dependency>
<groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.sling</groupId>
- <artifactId>org.apache.sling.commons.osgi</artifactId>
- <version>2.2.0</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>commons-lang</groupId>
- <artifactId>commons-lang</artifactId>
- <version>2.5</version>
- <scope>provided</scope>
+ <artifactId>osgi.core</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
- <version>1.6.2</version>
</dependency>
<dependency>
<groupId>junit</groupId>
diff --git a/src/main/java/org/apache/sling/hc/api/HealthCheck.java b/src/main/java/org/apache/sling/hc/api/HealthCheck.java
index 2fd269a..6ef4c77 100644
--- a/src/main/java/org/apache/sling/hc/api/HealthCheck.java
+++ b/src/main/java/org/apache/sling/hc/api/HealthCheck.java
@@ -17,8 +17,7 @@
*/
package org.apache.sling.hc.api;
-import aQute.bnd.annotation.ConsumerType;
-
+import org.osgi.annotation.versioning.ConsumerType;
/**
* Health Check services can be executed and
@@ -60,7 +59,7 @@ public interface HealthCheck {
* The value of this property must be of type String or String array.
*/
String TAGS = "hc.tags";
-
+
/**
* Optional service property: If this property is set the health check
* will be executed asynchronously using the cron expression provided.
@@ -69,7 +68,7 @@ public interface HealthCheck {
/**
* Optional service property: TTL for health check {@link Result}.
- * The value of this property must be of type {@link Long} and is
+ * The value of this property must be of type {@link Long} and is
* specified in ms.
*/
String RESULT_CACHE_TTL_IN_MS = "hc.resultCacheTtlInMs";
diff --git a/src/main/java/org/apache/sling/hc/api/execution/HealthCheckExecutionResult.java b/src/main/java/org/apache/sling/hc/api/execution/HealthCheckExecutionResult.java
index 8a09920..0f8ecd7 100644
--- a/src/main/java/org/apache/sling/hc/api/execution/HealthCheckExecutionResult.java
+++ b/src/main/java/org/apache/sling/hc/api/execution/HealthCheckExecutionResult.java
@@ -21,8 +21,8 @@ import java.util.Date;
import org.apache.sling.hc.api.Result;
import org.apache.sling.hc.util.HealthCheckMetadata;
+import org.osgi.annotation.versioning.ProviderType;
-import aQute.bnd.annotation.ProviderType;
/**
* Interface for health check executions via the {@link HealthCheckExecutor}.
diff --git a/src/main/java/org/apache/sling/hc/api/execution/HealthCheckExecutor.java b/src/main/java/org/apache/sling/hc/api/execution/HealthCheckExecutor.java
index e26843f..e41858c 100644
--- a/src/main/java/org/apache/sling/hc/api/execution/HealthCheckExecutor.java
+++ b/src/main/java/org/apache/sling/hc/api/execution/HealthCheckExecutor.java
@@ -20,8 +20,8 @@ package org.apache.sling.hc.api.execution;
import java.util.List;
import org.apache.sling.hc.api.HealthCheck;
+import org.osgi.annotation.versioning.ProviderType;
-import aQute.bnd.annotation.ProviderType;
/**
* Executes health checks registered as OSGi services and
@@ -42,7 +42,7 @@ public interface HealthCheckExecutor {
/**
* Executes all health checks with the supplied list of tags.
* If no tags are supplied, all health checks are executed.
- *
+ *
* @param options options for controlling execution behavior
* @param tags tags to be executed
*
diff --git a/src/main/java/org/apache/sling/hc/api/execution/package-info.java b/src/main/java/org/apache/sling/hc/api/execution/package-info.java
index 26383c4..dc8b8aa 100644
--- a/src/main/java/org/apache/sling/hc/api/execution/package-info.java
+++ b/src/main/java/org/apache/sling/hc/api/execution/package-info.java
@@ -20,5 +20,4 @@
@Version("1.1.0")
package org.apache.sling.hc.api.execution;
-import aQute.bnd.annotation.Version;
-
+import org.osgi.annotation.versioning.Version;
diff --git a/src/main/java/org/apache/sling/hc/api/package-info.java b/src/main/java/org/apache/sling/hc/api/package-info.java
index 659caa4..c79b3b4 100644
--- a/src/main/java/org/apache/sling/hc/api/package-info.java
+++ b/src/main/java/org/apache/sling/hc/api/package-info.java
@@ -20,5 +20,4 @@
@Version("1.1.0")
package org.apache.sling.hc.api;
-import aQute.bnd.annotation.Version;
-
+import org.osgi.annotation.versioning.Version;
diff --git a/src/main/java/org/apache/sling/hc/util/HealthCheckMetadata.java b/src/main/java/org/apache/sling/hc/util/HealthCheckMetadata.java
index f5fdcb5..efc378a 100644
--- a/src/main/java/org/apache/sling/hc/util/HealthCheckMetadata.java
+++ b/src/main/java/org/apache/sling/hc/util/HealthCheckMetadata.java
@@ -21,8 +21,6 @@ import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
-import org.apache.commons.lang.StringUtils;
-import org.apache.sling.commons.osgi.PropertiesUtil;
import org.apache.sling.hc.api.HealthCheck;
import org.osgi.framework.Constants;
import org.osgi.framework.ServiceReference;
@@ -120,8 +118,8 @@ public class HealthCheckMetadata {
}
/**
- * TTL for the result cache in ms.
- *
+ * TTL for the result cache in ms.
+ *
* @return TTL for the result cache or <code>null</code> if not configured.
*/
public Long getResultCacheTtlInMs() {
@@ -152,13 +150,22 @@ public class HealthCheckMetadata {
private String getHealthCheckTitle(final ServiceReference ref) {
String name = (String) ref.getProperty(HealthCheck.NAME);
- if (StringUtils.isBlank(name)) {
- name = PropertiesUtil.toString(ref.getProperty(Constants.SERVICE_DESCRIPTION), null);
+ if (name == null || name.isEmpty()) {
+ final Object val = ref.getProperty(Constants.SERVICE_DESCRIPTION);
+ if ( val != null ) {
+ name = val.toString();
+ }
}
- if (StringUtils.isBlank(name)) {
+ if (name == null || name.isEmpty()) {
name = "HealthCheck:" + ref.getProperty(Constants.SERVICE_ID);
- final String pid = PropertiesUtil.toString(ref.getProperty(Constants.SERVICE_PID), null);
- if ( !StringUtils.isBlank(pid) ) {
+ final Object val = ref.getProperty(Constants.SERVICE_PID);
+ String pid = null;
+ if ( val instanceof String ) {
+ pid = (String)val;
+ } else if ( val instanceof String[]) {
+ pid = Arrays.toString((String[])val);
+ }
+ if ( pid != null && !pid.isEmpty() ) {
name = name + " (" + pid + ")";
}
}
@@ -166,7 +173,7 @@ public class HealthCheckMetadata {
}
private List<String> arrayPropertyToListOfStr(final Object arrayProp) {
- List<String> res = new LinkedList<String>();
+ List<String> res = new LinkedList<>();
if (arrayProp instanceof String) {
res.add((String) arrayProp);
} else if (arrayProp instanceof String[]) {
diff --git a/src/main/java/org/apache/sling/hc/util/package-info.java b/src/main/java/org/apache/sling/hc/util/package-info.java
index 17a9969..131d715 100644
--- a/src/main/java/org/apache/sling/hc/util/package-info.java
+++ b/src/main/java/org/apache/sling/hc/util/package-info.java
@@ -20,5 +20,4 @@
@Version("1.3.0")
package org.apache.sling.hc.util;
-import aQute.bnd.annotation.Version;
-
+import org.osgi.annotation.versioning.Version;
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.