This is an automated email from the ASF dual-hosted git repository. bdelacretaz pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-capabilities.git
commit 9eb352819139097cc3db3b2bbc39603cf2fd3742 Author: Bertrand Delacretaz <[email protected]> AuthorDate: Wed Oct 10 15:01:19 2018 +0200 Use bnd-maven-plugin --- bnd.bnd | 13 ++++++++ pom.xml | 38 +++++++++------------- .../capabilities/internal/CapabilitiesServlet.java | 23 ++++++++----- .../apache/sling/capabilities/package-info.java | 22 ------------- 4 files changed, 42 insertions(+), 54 deletions(-) diff --git a/bnd.bnd b/bnd.bnd new file mode 100644 index 0000000..f5933e9 --- /dev/null +++ b/bnd.bnd @@ -0,0 +1,13 @@ +Bundle-Category: sling + +Bundle-Description: ${project.description} + +Bundle-DocURL: https://sling.apache.org + +Bundle-License: Apache License, Version 2.0 + +Bundle-Vendor: The Apache Software Foundation + +-removeheaders:\ + Include-Resource,\ + Private-Package diff --git a/pom.xml b/pom.xml index c566b9e..c89c363 100644 --- a/pom.xml +++ b/pom.xml @@ -21,7 +21,7 @@ <parent> <artifactId>sling</artifactId> <groupId>org.apache.sling</groupId> - <version>30</version> + <version>34</version> <relativePath/> </parent> <modelVersion>4.0.0</modelVersion> @@ -37,9 +37,9 @@ <build> <plugins> <plugin> - <groupId>org.apache.felix</groupId> - <artifactId>maven-scr-plugin</artifactId> - </plugin> + <groupId>biz.aQute.bnd</groupId> + <artifactId>bnd-maven-plugin</artifactId> + </plugin> <plugin> <groupId>org.apache.felix</groupId> <artifactId>maven-bundle-plugin</artifactId> @@ -56,8 +56,14 @@ </build> <dependencies> <dependency> - <groupId>biz.aQute.bnd</groupId> - <artifactId>biz.aQute.bndlib</artifactId> + <groupId>org.osgi</groupId> + <artifactId>org.osgi.service.component.annotations</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.osgi</groupId> + <artifactId>org.osgi.annotation.versioning</artifactId> + <scope>provided</scope> </dependency> <dependency> <groupId>org.apache.sling</groupId> @@ -72,11 +78,6 @@ </dependency> <dependency> <groupId>org.apache.felix</groupId> - <artifactId>org.apache.felix.scr.annotations</artifactId> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>org.apache.felix</groupId> <artifactId>org.apache.felix.utils</artifactId> <version>1.9.0</version> <scope>provided</scope> @@ -86,16 +87,7 @@ <artifactId>osgi.core</artifactId> <scope>provided</scope> </dependency> - <dependency> - <groupId>org.osgi</groupId> - <artifactId>osgi.cmpn</artifactId> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-api</artifactId> - <scope>provided</scope> - </dependency> + <!-- TESTING --> <dependency> <groupId>org.apache.sling</groupId> @@ -106,13 +98,13 @@ <dependency> <groupId>org.apache.sling</groupId> <artifactId>org.apache.sling.testing.osgi-mock</artifactId> - <version>2.3.8</version> + <version>2.4.2</version> <scope>test</scope> </dependency> <dependency> <groupId>org.apache.sling</groupId> <artifactId>org.apache.sling.testing.sling-mock</artifactId> - <version>2.2.18</version> + <version>2.3.4</version> <scope>test</scope> </dependency> <dependency> diff --git a/src/main/java/org/apache/sling/capabilities/internal/CapabilitiesServlet.java b/src/main/java/org/apache/sling/capabilities/internal/CapabilitiesServlet.java index 7f0793a..7ccddbd 100644 --- a/src/main/java/org/apache/sling/capabilities/internal/CapabilitiesServlet.java +++ b/src/main/java/org/apache/sling/capabilities/internal/CapabilitiesServlet.java @@ -20,6 +20,7 @@ package org.apache.sling.capabilities.internal; import java.io.IOException; import java.util.List; +import java.util.concurrent.CopyOnWriteArrayList; import javax.servlet.Servlet; import javax.servlet.ServletException; import org.apache.sling.api.SlingHttpServletRequest; @@ -38,18 +39,10 @@ property = { "sling.servlet.methods=GET", "sling.servlet.extensions=json" }) - public class CapabilitiesServlet extends SlingSafeMethodsServlet { - @Reference( - policy=ReferencePolicy.DYNAMIC, - cardinality=ReferenceCardinality.AT_LEAST_ONE, - policyOption=ReferencePolicyOption.GREEDY) - volatile List<CapabilitiesSource> sources; + private final List<CapabilitiesSource> sources = new CopyOnWriteArrayList<>(); - CapabilitiesServlet() { - } - @Override protected void doGet(SlingHttpServletRequest request, SlingHttpServletResponse response) throws ServletException, IOException { response.setContentType("application/json"); @@ -57,4 +50,16 @@ public class CapabilitiesServlet extends SlingSafeMethodsServlet { new JSONCapabilitiesWriter().writeJson(response.getWriter(), sources); response.getWriter().flush(); } + + @Reference( + policy=ReferencePolicy.DYNAMIC, + cardinality=ReferenceCardinality.AT_LEAST_ONE, + policyOption=ReferencePolicyOption.GREEDY) + protected void bindSource(CapabilitiesSource src) { + sources.add(src); + } + + protected void unbindSource(CapabilitiesSource src) { + sources.remove(src); + } } \ No newline at end of file diff --git a/src/main/java/org/apache/sling/capabilities/package-info.java b/src/main/java/org/apache/sling/capabilities/package-info.java deleted file mode 100644 index 2912df8..0000000 --- a/src/main/java/org/apache/sling/capabilities/package-info.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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. - */ - -@Version("1.0.0") -package org.apache.sling.capabilities; -import org.osgi.annotation.versioning.Version; \ No newline at end of file
