This is an automated email from the ASF dual-hosted git repository.
cziegeler pushed a commit to branch master
in repository
https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-spi.git
The following commit(s) were added to refs/heads/master by this push:
new fe56342 SLING-12762 : Support Jakarta Servlet API in Scripting SPI
fe56342 is described below
commit fe56342e91ace10db982ff98405b2d33615d6937
Author: Carsten Ziegeler <[email protected]>
AuthorDate: Fri Apr 25 07:08:45 2025 +0200
SLING-12762 : Support Jakarta Servlet API in Scripting SPI
---
pom.xml | 161 +++++++++++----------
.../sling/api/resource/type/ResourceType.java | 54 +++----
.../sling/api/resource/type/package-info.java | 34 ++---
.../scripting/spi/bundle/BundledRenderUnit.java | 84 +++++++----
.../spi/bundle/BundledRenderUnitCapability.java | 60 ++++----
.../spi/bundle/BundledRenderUnitFinder.java | 46 +++---
.../sling/scripting/spi/bundle/TypeProvider.java | 43 +++---
.../sling/scripting/spi/bundle/package-info.java | 36 ++---
.../sling/api/resource/type/ResourceTypeTest.java | 49 +++----
9 files changed, 306 insertions(+), 261 deletions(-)
diff --git a/pom.xml b/pom.xml
index 187c04a..ff88283 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
+<?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
@@ -23,30 +23,104 @@
<parent>
<groupId>org.apache.sling</groupId>
<artifactId>sling-bundle-parent</artifactId>
- <version>43</version>
+ <version>62</version>
<relativePath />
</parent>
<artifactId>org.apache.sling.scripting.spi</artifactId>
- <version>1.0.5-SNAPSHOT</version>
+ <version>2.0.0-SNAPSHOT</version>
<name>Apache Sling Scripting SPI</name>
- <description>
- This bundle defines the Apache Sling Scripting SPI
- </description>
+ <description>This bundle defines the Apache Sling Scripting
SPI</description>
<scm>
<connection>scm:git:https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-spi.git</connection>
<developerConnection>scm:git:https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-spi.git</developerConnection>
+ <tag>HEAD</tag>
<url>https://github.com/apache/sling-org-apache-sling-scripting-spi.git</url>
- <tag>HEAD</tag>
</scm>
<properties>
<project.build.outputTimestamp>2021-07-15T17:03:18Z</project.build.outputTimestamp>
+ <sling.java.version>17</sling.java.version>
</properties>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.sling</groupId>
+ <artifactId>org.apache.sling.api</artifactId>
+ <version>3.0.0-SNAPSHOT</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.http.wrappers</artifactId>
+ <version>6.1.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jetbrains</groupId>
+ <artifactId>annotations</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.annotation.versioning</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.framework</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>javax.servlet-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>jakarta.servlet</groupId>
+ <artifactId>jakarta.servlet-api</artifactId>
+ <version>6.0.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
<build>
+ <pluginManagement>
+ <plugins>
+ <!--This plugin's configuration is used to store Eclipse m2e
settings only. It has no influence on the Maven build itself.-->
+ <plugin>
+ <groupId>org.eclipse.m2e</groupId>
+ <artifactId>lifecycle-mapping</artifactId>
+ <version>1.0.0</version>
+ <configuration>
+ <lifecycleMappingMetadata>
+ <pluginExecutions>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>com.github.spotbugs</groupId>
+
<artifactId>spotbugs-maven-plugin</artifactId>
+ <versionRange>[3.1.11,)</versionRange>
+ <goals>
+ <goal>check</goal>
+ </goals>
+ </pluginExecutionFilter>
+ <action>
+ <ignore />
+ </action>
+ </pluginExecution>
+ </pluginExecutions>
+ </lifecycleMappingMetadata>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
<plugins>
<plugin>
<groupId>biz.aQute.bnd</groupId>
@@ -55,9 +129,6 @@
<plugin>
<groupId>biz.aQute.bnd</groupId>
<artifactId>bnd-baseline-maven-plugin</artifactId>
- <configuration>
- <skip>true</skip>
- </configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@@ -66,7 +137,7 @@
<plugin>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
- <version>3.1.11</version>
+ <version>4.9.3.0</version>
<configuration>
<effort>Max</effort>
<xmlOutput>true</xmlOutput>
@@ -74,80 +145,14 @@
<executions>
<execution>
<id>find-bugs</id>
- <phase>process-classes</phase>
<goals>
<goal>check</goal>
</goals>
+ <phase>process-classes</phase>
</execution>
</executions>
</plugin>
</plugins>
- <pluginManagement>
- <plugins>
- <!--This plugin's configuration is used to store Eclipse m2e
settings only. It has no influence on the Maven build itself.-->
- <plugin>
- <groupId>org.eclipse.m2e</groupId>
- <artifactId>lifecycle-mapping</artifactId>
- <version>1.0.0</version>
- <configuration>
- <lifecycleMappingMetadata>
- <pluginExecutions>
- <pluginExecution>
- <pluginExecutionFilter>
- <groupId>
- com.github.spotbugs
- </groupId>
- <artifactId>
- spotbugs-maven-plugin
- </artifactId>
- <versionRange>
- [3.1.11,)
- </versionRange>
- <goals>
- <goal>check</goal>
- </goals>
- </pluginExecutionFilter>
- <action>
- <ignore />
- </action>
- </pluginExecution>
- </pluginExecutions>
- </lifecycleMappingMetadata>
- </configuration>
- </plugin>
- </plugins>
- </pluginManagement>
</build>
- <dependencies>
- <dependency>
- <groupId>org.jetbrains</groupId>
- <artifactId>annotations</artifactId>
- </dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.annotation.versioning</artifactId>
- </dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.framework</artifactId>
- </dependency>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>javax.servlet-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-lang3</artifactId>
- <version>3.4</version>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
</project>
diff --git a/src/main/java/org/apache/sling/api/resource/type/ResourceType.java
b/src/main/java/org/apache/sling/api/resource/type/ResourceType.java
index 53ea13f..328ff6e 100644
--- a/src/main/java/org/apache/sling/api/resource/type/ResourceType.java
+++ b/src/main/java/org/apache/sling/api/resource/type/ResourceType.java
@@ -1,27 +1,26 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ~ 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.
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+/*
+ * 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.api.resource.type;
import java.util.Objects;
import java.util.regex.Pattern;
-import org.apache.commons.lang3.StringUtils;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.osgi.framework.Version;
@@ -40,7 +39,8 @@ import org.osgi.framework.Version;
*/
public final class ResourceType {
- private static final Pattern versionPattern =
Pattern.compile("(\\d{1,10})(\\.(\\d{1,10})(\\.(\\d{1,10})(\\.([-\\w]+))?)?)?$");
+ private static final Pattern versionPattern =
+
Pattern.compile("(\\d{1,10})(\\.(\\d{1,10})(\\.(\\d{1,10})(\\.([-\\w]+))?)?)?$");
private final String type;
private final Version version;
@@ -115,9 +115,9 @@ public final class ResourceType {
*/
@NotNull
public static ResourceType parseResourceType(@NotNull String
resourceTypeString) {
- String type = StringUtils.EMPTY;
+ String type = "";
Version version = null;
- if (StringUtils.isNotEmpty(resourceTypeString)) {
+ if (resourceTypeString != null && !resourceTypeString.isEmpty()) {
int lastSlash = resourceTypeString.lastIndexOf('/');
if (lastSlash != -1 && !resourceTypeString.endsWith("/")) {
String versionString = resourceTypeString.substring(lastSlash
+ 1);
@@ -135,8 +135,9 @@ public final class ResourceType {
type = resourceTypeString;
}
}
- if (StringUtils.isEmpty(type)) {
- throw new IllegalArgumentException(String.format("Cannot extract a
type for the resourceTypeString %s.", resourceTypeString));
+ if (type.isEmpty()) {
+ throw new IllegalArgumentException(
+ String.format("Cannot extract a type for the
resourceTypeString %s.", resourceTypeString));
}
return new ResourceType(type, version);
}
@@ -153,8 +154,9 @@ public final class ResourceType {
}
if (obj instanceof ResourceType) {
ResourceType other = (ResourceType) obj;
- return Objects.equals(type, other.type) && Objects.equals(version,
other.version) && Objects.equals(resourceLabel,
- other.resourceLabel);
+ return Objects.equals(type, other.type)
+ && Objects.equals(version, other.version)
+ && Objects.equals(resourceLabel, other.resourceLabel);
}
return false;
}
diff --git a/src/main/java/org/apache/sling/api/resource/type/package-info.java
b/src/main/java/org/apache/sling/api/resource/type/package-info.java
index 515d14d..d5dfb71 100644
--- a/src/main/java/org/apache/sling/api/resource/type/package-info.java
+++ b/src/main/java/org/apache/sling/api/resource/type/package-info.java
@@ -1,21 +1,21 @@
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ~ 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.
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+~ 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.api.resource.type;
diff --git
a/src/main/java/org/apache/sling/scripting/spi/bundle/BundledRenderUnit.java
b/src/main/java/org/apache/sling/scripting/spi/bundle/BundledRenderUnit.java
index f935a73..cde1c11 100644
--- a/src/main/java/org/apache/sling/scripting/spi/bundle/BundledRenderUnit.java
+++ b/src/main/java/org/apache/sling/scripting/spi/bundle/BundledRenderUnit.java
@@ -1,30 +1,32 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ~ 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.
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+/*
+ * 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.scripting.spi.bundle;
+import javax.script.ScriptException;
+
import java.io.InputStream;
import java.util.Set;
-import javax.script.ScriptException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
+import org.apache.sling.api.wrappers.JakartaToJavaxRequestWrapper;
+import org.apache.sling.api.wrappers.JakartaToJavaxResponseWrapper;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.osgi.annotation.versioning.ConsumerType;
@@ -66,7 +68,8 @@ public interface BundledRenderUnit {
*
* @return the name {@code this BundledRenderUnit}
*/
- @NotNull String getName();
+ @NotNull
+ String getName();
/**
* Returns the {@link Bundle} the publishing bundle of this unit (not to
be confused with the provider module, which is the module that
@@ -80,7 +83,8 @@ public interface BundledRenderUnit {
*
* @return the bundle providing this unit
*/
- @NotNull Bundle getBundle();
+ @NotNull
+ Bundle getBundle();
/**
* Returns the {@link BundleContext} to use for this unit. This method can
be useful for getting an instance of the publishing bundle's
@@ -88,7 +92,8 @@ public interface BundledRenderUnit {
*
* @return the bundle context of the bundle publishing this unit
*/
- @NotNull BundleContext getBundleContext();
+ @NotNull
+ BundleContext getBundleContext();
/**
* Returns the {@code Set} of {@link TypeProvider}s which are related to
this unit.
@@ -96,7 +101,8 @@ public interface BundledRenderUnit {
* @return the set of providers; if the unit doesn't have any inheritance
chains, then the set will contain only one {@link
* TypeProvider}
*/
- @NotNull Set<TypeProvider> getTypeProviders();
+ @NotNull
+ Set<TypeProvider> getTypeProviders();
/**
* Retrieves an OSGi runtime dependency of the wrapped script identified
by the passed {@code className} parameter.
@@ -105,7 +111,8 @@ public interface BundledRenderUnit {
* @param <T> the expected service type
* @return an instance of the {@link T} or {@code null}
*/
- @Nullable <T> T getService(@NotNull String className);
+ @Nullable
+ <T> T getService(@NotNull String className);
/**
* Retrieves multiple instances of an OSGi runtime dependency of the
wrapped script identified by the passed {@code className}
@@ -117,7 +124,8 @@ public interface BundledRenderUnit {
* @param <T> the expected service type
* @return an instance of the {@link T} or {@code null}
*/
- @Nullable <T> T[] getServices(@NotNull String className, @Nullable String
filter);
+ @Nullable
+ <T> T[] getServices(@NotNull String className, @Nullable String filter);
/**
* Returns the path of this executable in the resource type hierarchy. The
path can be relative to the search paths or absolute.
@@ -132,8 +140,26 @@ public interface BundledRenderUnit {
* @param request the request
* @param response the response
* @throws ScriptException if the execution leads to an error
+ * @since 1.1.0
+ */
+ default void eval(@NotNull HttpServletRequest request, @NotNull
HttpServletResponse response)
+ throws ScriptException {
+ eval(
+ JakartaToJavaxRequestWrapper.toJavaxRequest(request),
+ JakartaToJavaxResponseWrapper.toJavaxResponse(response));
+ }
+
+ /**
+ * This method will execute / evaluate the wrapped script or precompiled
script with the given request.
+ * @param request the request
+ * @param response the response
+ * @throws ScriptException if the execution leads to an error
+ * @deprecated use {@link #eval(HttpServletRequest, HttpServletResponse)}
instead
*/
- void eval(@NotNull HttpServletRequest request, @NotNull
HttpServletResponse response) throws ScriptException;
+ void eval(
+ @NotNull javax.servlet.http.HttpServletRequest request,
+ @NotNull javax.servlet.http.HttpServletResponse response)
+ throws ScriptException;
/**
* This method will return an input stream if {@code this} unit is backed
by a script that can be interpreted.
diff --git
a/src/main/java/org/apache/sling/scripting/spi/bundle/BundledRenderUnitCapability.java
b/src/main/java/org/apache/sling/scripting/spi/bundle/BundledRenderUnitCapability.java
index 8fd5788..388574f 100644
---
a/src/main/java/org/apache/sling/scripting/spi/bundle/BundledRenderUnitCapability.java
+++
b/src/main/java/org/apache/sling/scripting/spi/bundle/BundledRenderUnitCapability.java
@@ -1,21 +1,21 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ~ 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.
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+/*
+ * 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.scripting.spi.bundle;
import java.util.List;
@@ -38,7 +38,8 @@ public interface BundledRenderUnitCapability {
*
* @return the resource types to which a {@link BundledRenderUnit}
described by this capability will be bound to
*/
- @NotNull Set<ResourceType> getResourceTypes();
+ @NotNull
+ Set<ResourceType> getResourceTypes();
/**
* Returns the path to which a {@link BundledRenderUnit} described by this
capability will be bound to.
@@ -46,47 +47,54 @@ public interface BundledRenderUnitCapability {
* @return the path to which a {@link BundledRenderUnit} described by this
capability will be bound to; this can be {@code null} if the
* {@link #getResourceTypes()} doesn't return an empty set
*/
- @Nullable String getPath();
+ @Nullable
+ String getPath();
/**
* Returns the selectors to which a {@link BundledRenderUnit} described by
this capability will be bound to.
*
* @return the selectors to which a {@link BundledRenderUnit} described by
this capability will be bound to
*/
- @NotNull List<String> getSelectors();
+ @NotNull
+ List<String> getSelectors();
/**
* Returns the extension to which a {@link BundledRenderUnit} described by
this capability will be bound to.
*
* @return the extension to which a {@link BundledRenderUnit} described by
this capability will be bound to
*/
- @Nullable String getExtension();
+ @Nullable
+ String getExtension();
/**
* Returns the resource type extended by this capability.
*
* @return the extended resource type or {@code null}
*/
- @Nullable String getExtendedResourceType();
+ @Nullable
+ String getExtendedResourceType();
/**
* Returns the request method to which a {@link BundledRenderUnit}
described by this capability will be bound to.
*
* @return the request method to which a {@link BundledRenderUnit}
described by this capability will be bound to
*/
- @Nullable String getMethod();
+ @Nullable
+ String getMethod();
/**
* Returns the script engine short name which can be used to evaluate the
{@link BundledRenderUnit} described by this capability.
*
* @return the script engine short name which can be used to evaluate the
{@link BundledRenderUnit} described by this capability.
*/
- @Nullable String getScriptEngineName();
+ @Nullable
+ String getScriptEngineName();
/**
* Returns the original's script extension that was used to generate this
capability.
*
* @return the original's script extension that was used to generate this
capability.
*/
- @Nullable String getScriptExtension();
+ @Nullable
+ String getScriptExtension();
}
diff --git
a/src/main/java/org/apache/sling/scripting/spi/bundle/BundledRenderUnitFinder.java
b/src/main/java/org/apache/sling/scripting/spi/bundle/BundledRenderUnitFinder.java
index 800c33d..ba6d2b2 100644
---
a/src/main/java/org/apache/sling/scripting/spi/bundle/BundledRenderUnitFinder.java
+++
b/src/main/java/org/apache/sling/scripting/spi/bundle/BundledRenderUnitFinder.java
@@ -1,21 +1,21 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ~ 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.
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+/*
+ * 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.scripting.spi.bundle;
import java.util.Set;
@@ -45,7 +45,10 @@ public interface BundledRenderUnitFinder {
* @return a {@link BundledRenderUnit} if one was found, {@code null}
otherwise
*/
@Nullable
- BundledRenderUnit findUnit(@NotNull BundleContext context, @NotNull
Set<TypeProvider> inheritanceChain, @NotNull Set<TypeProvider>
allRelatedProviders);
+ BundledRenderUnit findUnit(
+ @NotNull BundleContext context,
+ @NotNull Set<TypeProvider> inheritanceChain,
+ @NotNull Set<TypeProvider> allRelatedProviders);
/**
* Retrieves a path-based {@link BundledRenderUnit} from the passed {@code
provider}.
@@ -59,5 +62,8 @@ public interface BundledRenderUnitFinder {
* @see BundledRenderUnitCapability#getPath()
*/
@Nullable
- BundledRenderUnit findUnit(@NotNull BundleContext context, @NotNull
TypeProvider provider, @NotNull Set<TypeProvider> allRelatedProviders);
+ BundledRenderUnit findUnit(
+ @NotNull BundleContext context,
+ @NotNull TypeProvider provider,
+ @NotNull Set<TypeProvider> allRelatedProviders);
}
diff --git
a/src/main/java/org/apache/sling/scripting/spi/bundle/TypeProvider.java
b/src/main/java/org/apache/sling/scripting/spi/bundle/TypeProvider.java
index c68f9a7..b60b1c8 100644
--- a/src/main/java/org/apache/sling/scripting/spi/bundle/TypeProvider.java
+++ b/src/main/java/org/apache/sling/scripting/spi/bundle/TypeProvider.java
@@ -1,21 +1,21 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ~ 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.
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+/*
+ * 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.scripting.spi.bundle;
import org.jetbrains.annotations.NotNull;
@@ -33,13 +33,14 @@ public interface TypeProvider {
*
* @return the {@link BundledRenderUnitCapability}
*/
- @NotNull BundledRenderUnitCapability getBundledRenderUnitCapability();
+ @NotNull
+ BundledRenderUnitCapability getBundledRenderUnitCapability();
/**
* Returns the providing bundle.
*
* @return the providing bundle
*/
- @NotNull Bundle getBundle();
-
+ @NotNull
+ Bundle getBundle();
}
diff --git
a/src/main/java/org/apache/sling/scripting/spi/bundle/package-info.java
b/src/main/java/org/apache/sling/scripting/spi/bundle/package-info.java
index b2b217f..53aab12 100644
--- a/src/main/java/org/apache/sling/scripting/spi/bundle/package-info.java
+++ b/src/main/java/org/apache/sling/scripting/spi/bundle/package-info.java
@@ -1,22 +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.
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-@Version("1.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.1.0")
package org.apache.sling.scripting.spi.bundle;
import org.osgi.annotation.versioning.Version;
diff --git
a/src/test/java/org/apache/sling/api/resource/type/ResourceTypeTest.java
b/src/test/java/org/apache/sling/api/resource/type/ResourceTypeTest.java
index 2ec07d5..9542a46 100644
--- a/src/test/java/org/apache/sling/api/resource/type/ResourceTypeTest.java
+++ b/src/test/java/org/apache/sling/api/resource/type/ResourceTypeTest.java
@@ -1,34 +1,32 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ~ 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.
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+/*
+ * 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.api.resource.type;
-import static org.junit.Assert.assertEquals;
-
-import org.apache.commons.lang3.StringUtils;
import org.junit.Test;
import org.osgi.framework.Version;
+import static org.junit.Assert.assertEquals;
+
public class ResourceTypeTest {
- private void assertResourceType(String resourceTypeString,
- String expectedType, String expectedResourceLabel,
- Version expectedVersion) {
+ private void assertResourceType(
+ String resourceTypeString, String expectedType, String
expectedResourceLabel, Version expectedVersion) {
ResourceType t1 = ResourceType.parseResourceType(resourceTypeString);
assertEquals(expectedType, t1.getType());
assertEquals(expectedResourceLabel, t1.getResourceLabel());
@@ -83,12 +81,11 @@ public class ResourceTypeTest {
@Test(expected = IllegalArgumentException.class)
public void testEmptyString() {
- ResourceType.parseResourceType(StringUtils.EMPTY);
+ ResourceType.parseResourceType("");
}
@Test(expected = IllegalArgumentException.class)
public void testNull() {
ResourceType.parseResourceType(null); // NOSONAR
}
-
}