You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by kw...@apache.org on 2024/02/06 13:17:07 UTC

(sling-whiteboard) branch feature/resourcechangelistener-annotations created (now 786d10a8)

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

kwin pushed a change to branch feature/resourcechangelistener-annotations
in repository https://gitbox.apache.org/repos/asf/sling-whiteboard.git


      at 786d10a8 SLING-12247: Add OSGi component property type annotation for Sling Resource Observation

This branch includes the following new commits:

     new 786d10a8 SLING-12247: Add OSGi component property type annotation for Sling Resource Observation

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(sling-whiteboard) 01/01: SLING-12247: Add OSGi component property type annotation for Sling Resource Observation

Posted by kw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

kwin pushed a commit to branch feature/resourcechangelistener-annotations
in repository https://gitbox.apache.org/repos/asf/sling-whiteboard.git

commit 786d10a811fe1de0f09414e65dedee42f9621691
Author: Konrad Windszus <kw...@apache.org>
AuthorDate: Tue Feb 6 14:17:01 2024 +0100

    SLING-12247: Add OSGi component property type annotation for Sling
    Resource Observation
---
 .../.gitignore                                     |  18 ++
 .../CODE_OF_CONDUCT.md                             |  22 +++
 .../CONTRIBUTING.md                                |  24 +++
 .../Jenkinsfile                                    |  20 ++
 .../LICENSE                                        | 202 +++++++++++++++++++++
 .../README.md                                      |  12 ++
 .../pom.xml                                        | 126 +++++++++++++
 .../src/it/annotations-it/README.md                |   4 +
 .../src/it/annotations-it/bnd.bnd                  |   6 +
 .../src/it/annotations-it/invoker.properties       |  17 ++
 .../src/it/annotations-it/pom.xml                  |  77 ++++++++
 .../annotations/SampleResourceChangeListener.java  |  38 ++++
 .../src/it/annotations-it/verify.groovy            |  61 +++++++
 .../src/it/settings.xml                            |  59 ++++++
 .../annotations/SlingResourceChangeListener.java   | 106 +++++++++++
 15 files changed, 792 insertions(+)

diff --git a/sling-org-apache-sling-resourcechangelistener-annotations/.gitignore b/sling-org-apache-sling-resourcechangelistener-annotations/.gitignore
new file mode 100644
index 00000000..658337c9
--- /dev/null
+++ b/sling-org-apache-sling-resourcechangelistener-annotations/.gitignore
@@ -0,0 +1,18 @@
+target/
+/.project
+/.settings/
+/.classpath
+.idea
+.metadata
+.externalToolBuilders
+maven-eclipse.xml
+*.swp
+*.iml
+*.ipr
+*.iws
+*.bak
+.vlt
+.DS_Store
+jcr.log
+atlassian-ide-plugin.xml
+.vscode/
diff --git a/sling-org-apache-sling-resourcechangelistener-annotations/CODE_OF_CONDUCT.md b/sling-org-apache-sling-resourcechangelistener-annotations/CODE_OF_CONDUCT.md
new file mode 100644
index 00000000..0fa18e59
--- /dev/null
+++ b/sling-org-apache-sling-resourcechangelistener-annotations/CODE_OF_CONDUCT.md
@@ -0,0 +1,22 @@
+<!--/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+  ~ 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.
+  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/-->
+Apache Software Foundation Code of Conduct
+====
+
+Being an Apache project, Apache Sling adheres to the Apache Software Foundation's [Code of Conduct](https://www.apache.org/foundation/policies/conduct.html).
diff --git a/sling-org-apache-sling-resourcechangelistener-annotations/CONTRIBUTING.md b/sling-org-apache-sling-resourcechangelistener-annotations/CONTRIBUTING.md
new file mode 100644
index 00000000..ac82a1ab
--- /dev/null
+++ b/sling-org-apache-sling-resourcechangelistener-annotations/CONTRIBUTING.md
@@ -0,0 +1,24 @@
+<!--/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+  ~ 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.
+  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/-->
+Contributing
+====
+
+Thanks for choosing to contribute!
+
+You will find all the necessary details about how you can do this at https://sling.apache.org/contributing.html.
diff --git a/sling-org-apache-sling-resourcechangelistener-annotations/Jenkinsfile b/sling-org-apache-sling-resourcechangelistener-annotations/Jenkinsfile
new file mode 100644
index 00000000..f5825190
--- /dev/null
+++ b/sling-org-apache-sling-resourcechangelistener-annotations/Jenkinsfile
@@ -0,0 +1,20 @@
+/**
+ * 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.
+ */
+
+slingOsgiBundleBuild()
diff --git a/sling-org-apache-sling-resourcechangelistener-annotations/LICENSE b/sling-org-apache-sling-resourcechangelistener-annotations/LICENSE
new file mode 100644
index 00000000..d6456956
--- /dev/null
+++ b/sling-org-apache-sling-resourcechangelistener-annotations/LICENSE
@@ -0,0 +1,202 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed 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.
diff --git a/sling-org-apache-sling-resourcechangelistener-annotations/README.md b/sling-org-apache-sling-resourcechangelistener-annotations/README.md
new file mode 100644
index 00000000..6cb16835
--- /dev/null
+++ b/sling-org-apache-sling-resourcechangelistener-annotations/README.md
@@ -0,0 +1,12 @@
+[![Apache Sling](https://sling.apache.org/res/logos/sling.png)](https://sling.apache.org)
+
+TODO: add badges once migrated to the final repo
+
+# Apache Sling Resource Observation Annotations
+
+This module is part of the [Apache Sling](https://sling.apache.org) project.
+
+OSGi DS 1.4 component property type annotations for Sling Resource Observation API.
+They ease implementing `org.apache.sling.api.resource.observation.ResourceChangeListener` services.
+
+The annotations are documented on the following Apache Sling website page: <https://sling.apache.org/documentation/the-sling-engine/resources.html#resource-observation>.
\ No newline at end of file
diff --git a/sling-org-apache-sling-resourcechangelistener-annotations/pom.xml b/sling-org-apache-sling-resourcechangelistener-annotations/pom.xml
new file mode 100644
index 00000000..eabe75b6
--- /dev/null
+++ b/sling-org-apache-sling-resourcechangelistener-annotations/pom.xml
@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- 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. -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.sling</groupId>
+        <artifactId>sling</artifactId>
+        <version>60</version>
+        <relativePath />
+    </parent>
+
+    <artifactId>org.apache.sling.resource.observation.annotations</artifactId>
+    <version>1.2.7-SNAPSHOT</version>
+
+    <name>Apache Sling Resource Observation Annotations</name>
+    <description>OSGi DS 1.4 component property type annotations for Sling resource change listeners</description>
+
+    <scm>
+        <connection>scm:git:https://gitbox.apache.org/repos/asf/sling-org-apache-sling-servlets-annotations.git</connection>
+        <developerConnection>scm:git:https://gitbox.apache.org/repos/asf/sling-org-apache-sling-servlets-annotations.git</developerConnection>
+        <tag>HEAD</tag>
+        <url>https://gitbox.apache.org/repos/asf?p=sling-org-apache-sling-servlets-annotations.git</url>
+    </scm>
+
+    <properties>
+        <sling.java.version>8</sling.java.version>
+        <project.build.outputTimestamp>2021-06-07T21:11:58Z</project.build.outputTimestamp>
+    </properties>
+
+    <dependencies>
+        <!-- all transitive dependencies should have scope "provided" to prevent classpath
+             pollution of referencing projects -->
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.service.component.annotations</artifactId>
+            <version>1.4.0</version>
+            <!-- for annotation @ComponentPropertyType -->
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.service.component</artifactId>
+            <version>1.4.0</version>
+            <!-- for link in javadoc to default property types/annotations -->
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.annotation.bundle</artifactId>
+            <version>1.0.0</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.api</artifactId>
+            <!-- https://issues.apache.org/jira/browse/SLING-4751 -->
+            <version>2.11.0</version>
+            <scope>provided</scope>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-invoker-plugin</artifactId>
+                <configuration>
+                    <debug>false</debug>
+                    <projectsDirectory>src/it</projectsDirectory>
+                    <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
+                    <pomIncludes>
+                        <pomInclude>*/pom.xml</pomInclude>
+                    </pomIncludes>
+                    <postBuildHookScript>verify</postBuildHookScript>
+                    <localRepositoryPath>${project.build.directory}/it-repo</localRepositoryPath>
+                    <settingsFile>src/it/settings.xml</settingsFile>
+                    <!-- this causes verbose output, probably good to have for CI builds? -->
+                    <streamLogs>true</streamLogs>
+                </configuration>
+                <executions>
+                    <execution>
+                        <id>integration-test</id>
+                        <goals>
+                            <goal>install</goal>
+                            <goal>integration-test</goal>
+                            <goal>verify</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.rat</groupId>
+                <artifactId>apache-rat-plugin</artifactId>
+                <configuration>
+                    <excludes>
+                        <exclude>src/it/annotations-it/target/**</exclude>
+                        <exclude>src/it/annotations-it/README.md</exclude>
+                        <exclude>src/it/annotations-it/bnd.bnd</exclude>
+                        <exclude>src/it/annotations-it/build.log</exclude>
+                    </excludes>
+                </configuration>
+            </plugin>
+            <plugin>
+                <artifactId>maven-clean-plugin</artifactId>
+                <configuration>
+                    <filesets>
+                        <fileset>
+                            <directory>src/it/annotations-it/target</directory>
+                        </fileset>
+                    </filesets>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>
diff --git a/sling-org-apache-sling-resourcechangelistener-annotations/src/it/annotations-it/README.md b/sling-org-apache-sling-resourcechangelistener-annotations/src/it/annotations-it/README.md
new file mode 100644
index 00000000..1200b540
--- /dev/null
+++ b/sling-org-apache-sling-resourcechangelistener-annotations/src/it/annotations-it/README.md
@@ -0,0 +1,4 @@
+# Integration tests for the servlets annotations module.
+
+These tests use the `verify.groovy` script to validate generated
+OSGi service annotations.
diff --git a/sling-org-apache-sling-resourcechangelistener-annotations/src/it/annotations-it/bnd.bnd b/sling-org-apache-sling-resourcechangelistener-annotations/src/it/annotations-it/bnd.bnd
new file mode 100644
index 00000000..539b4adb
--- /dev/null
+++ b/sling-org-apache-sling-resourcechangelistener-annotations/src/it/annotations-it/bnd.bnd
@@ -0,0 +1,6 @@
+Sling-Initial-Content: SLING-CONTENT/content/servlettest;overwrite:=true;path:=/content/servlettest
+
+# This simulates using the right version of the servlets resolver bundle,
+# for the SlingServletPathsStrict annotation
+Provide-Capability:\
+  osgi.extender;osgi.extender="org.apache.sling.servlets.resolver";version:Version="1.1"
\ No newline at end of file
diff --git a/sling-org-apache-sling-resourcechangelistener-annotations/src/it/annotations-it/invoker.properties b/sling-org-apache-sling-resourcechangelistener-annotations/src/it/annotations-it/invoker.properties
new file mode 100644
index 00000000..b9bcb58b
--- /dev/null
+++ b/sling-org-apache-sling-resourcechangelistener-annotations/src/it/annotations-it/invoker.properties
@@ -0,0 +1,17 @@
+# 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.
+
+invoker.goals = clean verify -Dannotations.bundle.version=${project.version} -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN
+invoker.debug = false
\ No newline at end of file
diff --git a/sling-org-apache-sling-resourcechangelistener-annotations/src/it/annotations-it/pom.xml b/sling-org-apache-sling-resourcechangelistener-annotations/src/it/annotations-it/pom.xml
new file mode 100644
index 00000000..c8d5a943
--- /dev/null
+++ b/sling-org-apache-sling-resourcechangelistener-annotations/src/it/annotations-it/pom.xml
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- 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. -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.sling</groupId>
+        <artifactId>sling-bundle-parent</artifactId>
+        <version>60</version>
+        <relativePath />
+    </parent>
+
+    <artifactId>org.apache.sling.resourcechangelistener.annotations.it</artifactId>
+    <version>3.0.0</version>
+
+    <name>Apache Sling ResourceChangeListener Annotations IT</name>
+    <description>Integration tests for OSGi DS 1.4 component property type annotations for Sling resource change listeners</description>
+
+    <properties>
+        <sling.java.version>11</sling.java.version>
+        <annotations.bundle.version>MUST_BE_SET_BY_INVOKER</annotations.bundle.version>
+    </properties>
+
+    <dependencies>
+        <!--  dependency under test -->
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.resource.observation.annotations</artifactId>
+            <version>${annotations.bundle.version}</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.service.component.annotations</artifactId>
+            <version>1.3.0</version>
+            <!-- to be compliant with DS 1.3 -->
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.api</artifactId>
+            <version>2.27.2</version>
+            <scope>provided</scope>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>biz.aQute.bnd</groupId>
+                <artifactId>bnd-baseline-maven-plugin</artifactId>
+                <configuration>
+                    <skip>true</skip>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.rat</groupId>
+                <artifactId>apache-rat-plugin</artifactId>
+                <configuration>
+                    <excludes>
+                        <exclude>build.log</exclude>
+                    </excludes>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>
diff --git a/sling-org-apache-sling-resourcechangelistener-annotations/src/it/annotations-it/src/main/java/org/apache/sling/resource/observation/annotations/SampleResourceChangeListener.java b/sling-org-apache-sling-resourcechangelistener-annotations/src/it/annotations-it/src/main/java/org/apache/sling/resource/observation/annotations/SampleResourceChangeListener.java
new file mode 100644
index 00000000..3f4d39e9
--- /dev/null
+++ b/sling-org-apache-sling-resourcechangelistener-annotations/src/it/annotations-it/src/main/java/org/apache/sling/resource/observation/annotations/SampleResourceChangeListener.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.sling.resource.observation.annotations;
+
+import java.util.List;
+
+import org.apache.sling.api.resource.observation.ResourceChange;
+import org.apache.sling.api.resource.observation.ResourceChange.ChangeType;
+import org.apache.sling.api.resource.observation.ResourceChangeListener;
+import org.osgi.service.component.annotations.Component;
+
+@Component()
+@SlingResourceChangeListener(
+        paths = "/examplepath",
+        change_types = {ChangeType.ADDED, ChangeType.REMOVED})
+public class SampleResourceChangeListener implements ResourceChangeListener {
+
+    @Override
+    public void onChange(List<ResourceChange> changes) {
+        // Do nothing here
+    }
+}
diff --git a/sling-org-apache-sling-resourcechangelistener-annotations/src/it/annotations-it/verify.groovy b/sling-org-apache-sling-resourcechangelistener-annotations/src/it/annotations-it/verify.groovy
new file mode 100644
index 00000000..98fd86da
--- /dev/null
+++ b/sling-org-apache-sling-resourcechangelistener-annotations/src/it/annotations-it/verify.groovy
@@ -0,0 +1,61 @@
+/*
+ * 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.
+ */
+
+// Verify the OSGI-INF xml files generated by the bnd plugin based
+// on our annotations
+import groovy.xml.XmlSlurper
+def INVALID_CONFIG = 'Configuration is invalid'
+
+// Utility functions
+def getXml(filename) {
+    return new XmlSlurper().parse(new File(basedir, "target/classes/OSGI-INF/" + filename))
+}
+
+def assertTypedAttribute(xml, name, type, value) {
+    def errorMsg = name + " " + type + " attribute does not match " + value
+    assert(xml.property.find{ it.@name == name && it.@type == type && it.@value == value }) : errorMsg
+}
+
+def assertProperty(xml, name, type, String [] expected) {
+    def linesFromXml = xml.property.find{ it.@name == name && it.@type == type }.toString().split('\n')
+    expected.each {
+        def errorMsg = name + " " + type + " does not contain " + it
+        assert(linesFromXml.contains(it)) : errorMsg
+    }
+    assert(linesFromXml.length == expected.length)
+}
+
+def assertNoProperty(xml, String [] names) {
+    names.each {
+        def name = it
+        xml.property.find{ it.@name == name }.each {
+            assert(false) : "did not expect " + it + " for " + name
+        }
+    }
+}
+
+// The actual tests
+{
+    def xml=getXml("org.apache.sling.resource.observation.annotations.SampleResourceChangeListener.xml")
+    assertProperty(xml, 'resource.paths', 'String', '/examplepath')
+    assertProperty(xml, 'resource.change.types', 'String', 'ADDED', 'REMOVED')
+    assertNoProperty(xml,
+        'resource.property.names.hint',
+    )
+}
+
+return true
diff --git a/sling-org-apache-sling-resourcechangelistener-annotations/src/it/settings.xml b/sling-org-apache-sling-resourcechangelistener-annotations/src/it/settings.xml
new file mode 100644
index 00000000..3404fdaa
--- /dev/null
+++ b/sling-org-apache-sling-resourcechangelistener-annotations/src/it/settings.xml
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+
+<!--
+    As per https://maven.apache.org/plugins/maven-invoker-plugin/examples/fast-use.html
+    this lets invoked builds grab artifacts from the local repository instead of
+    downloading all of them.
+-->
+<settings>
+    <profiles>
+    <profile>
+        <id>it-repo</id>
+        <activation>
+        <activeByDefault>true</activeByDefault>
+        </activation>
+        <repositories>
+        <repository>
+            <id>local.central</id>
+            <url>@localRepositoryUrl@</url>
+            <releases>
+            <enabled>true</enabled>
+            </releases>
+            <snapshots>
+            <enabled>true</enabled>
+            </snapshots>
+        </repository>
+        </repositories>
+        <pluginRepositories>
+        <pluginRepository>
+            <id>local.central</id>
+            <url>@localRepositoryUrl@</url>
+            <releases>
+            <enabled>true</enabled>
+            </releases>
+            <snapshots>
+            <enabled>true</enabled>
+            </snapshots>
+        </pluginRepository>
+        </pluginRepositories>
+    </profile>
+    </profiles>
+</settings>
\ No newline at end of file
diff --git a/sling-org-apache-sling-resourcechangelistener-annotations/src/main/java/org/apache/sling/resource/observation/annotations/SlingResourceChangeListener.java b/sling-org-apache-sling-resourcechangelistener-annotations/src/main/java/org/apache/sling/resource/observation/annotations/SlingResourceChangeListener.java
new file mode 100644
index 00000000..eb8c4830
--- /dev/null
+++ b/sling-org-apache-sling-resourcechangelistener-annotations/src/main/java/org/apache/sling/resource/observation/annotations/SlingResourceChangeListener.java
@@ -0,0 +1,106 @@
+/*
+ * 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.sling.resource.observation.annotations;
+
+import org.apache.sling.api.resource.observation.ExternalResourceChangeListener;
+import org.apache.sling.api.resource.observation.ResourceChange;
+import org.apache.sling.api.resource.observation.ResourceChangeListener;
+import org.osgi.service.component.annotations.ComponentPropertyType;
+
+/**
+ * <a href="https://docs.osgi.org/specification/osgi.cmpn/7.0.0/service.component.html#service.component-component.property.types">
+ * Component Property Type (as defined by OSGi DS 1.4)</a> for Sling (External)ResourceChangeListener services.
+ * Takes care of writing the relevant service properties as being used by the Sling Observation
+ * to register the annotated {@link ResourceChangeListener} or {@link ExternalResourceChangeListener} component
+ * with the correct restrictions.
+ *
+ * @see ResourceChangeListener
+ * @see ExternalResourceChangeListener
+ */
+@ComponentPropertyType
+public @interface SlingResourceChangeListener {
+
+    /**
+     * Prefix for every property being generated from the annotations elements (as defined in OSGi 7 Compendium, 112.8.2.1)
+     */
+    static final String PREFIX_ = "resource.";
+
+    /**
+     * <p>Array of paths or glob patterns - required.</p>
+     *
+     * <p>A path is either absolute or relative. If it's a relative path, the relative path will be appended to all search paths of the
+     * resource resolver.</p>
+     *
+     * <p>If the whole tree of all search paths should be observed, the special value {@code .} should be used.</p>
+     *
+     * <p>A glob pattern must start with the {@code glob:} prefix (e.g. <code>glob:**&#47;*.html</code>). The following rules are used
+     * to interpret glob patterns:</p>
+     * <ul>
+     *     <li>The {@code *} character matches zero or more characters of a name component without crossing directory boundaries.</li>
+     *     <li>The {@code **} characters match zero or more characters crossing directory boundaries.</li>
+     *     <li>If the pattern is relative (does not start with a slash), the relative path will be appended to all search paths of
+     *        the resource resolver.
+     * </ul>
+     *
+     * <p>
+     * In general, it can't be guaranteed that the underlying implementation of the resources will send a remove
+     * event for each removed resource. For example if the root of a tree, like {@code /foo} is removed, the underlying
+     * implementation might only send a single remove event for {@code /foo} but not for any child resources.
+     * Therefore if a listener is interested in resource remove events, it might get remove events for resources
+     * that not directly match the specified pattern/filters. For example if a listener is registered for {@code /foo/bar}
+     * and {@code /foo} is removed, the listener will get a remove event for {@code /foo}. The same is true if any pattern is used
+     * and any parent of a matching resource is removed. If a listener is interested in
+     * remove events, it will get a remove of any parent resource from the specified paths or patterns. The listener
+     * must handle these events accordingly.
+     *
+     * <p>If one of the paths is a sub resource of another specified path, the sub path is ignored.</p>
+     *
+     * <p>If this property is missing or invalid, the listener is ignored. The type of the property must either be String, or a String
+     * array.</p>
+     *
+     * @see ResourceChangeListener#PATHS
+     */
+    String[] paths();
+
+    /**
+     * Array of change types - optional.
+     * If this property is missing, added, removed and changed events for resources
+     * and added and removed events for resource providers are reported.
+     *
+     * @see ResourceChangeListener#CHANGES
+     * @see ResourceChangeType
+     */
+    ResourceChange.ChangeType[] change_types() default {};
+
+    /**
+     * An optional hint indicating to the underlying implementation that for
+     * changes regarding properties (added/removed/changed) the listener
+     * is only interested in those property names listed inhere.
+     * If the underlying implementation supports this, events for property names that
+     * are not enlisted here will not be delivered, however events
+     * concerning resources are not affected by this hint.
+     * This is only a hint, a change listener registering with this property
+     * must be prepared that the underlying implementation is not able to filter
+     * based on this property. In this case the listener gets all events
+     * as defined with the other properties.
+     *
+     * @see ResourceChangeListener#PROPERTY_NAMES_HINT
+     */
+    String[] property_names_hint() default {};
+}