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

olli pushed a commit to branch master
in repository 
https://gitbox.apache.org/repos/asf/sling-org-apache-sling-servlets-resolver.git


The following commit(s) were added to refs/heads/master by this push:
     new 8262ce6  SLING-9999 Remove cyclic dependency between scripting and 
servlets features
8262ce6 is described below

commit 8262ce63725b9ab93c1d3eb07ace6b02d79acc65
Author: Oliver Lietz <[email protected]>
AuthorDate: Mon Dec 28 23:38:33 2020 +0100

    SLING-9999 Remove cyclic dependency between scripting and servlets features
    
    remove ResourceType and Bundle API and use org.apache.sling.api and 
org.apache.sling.scripting.api instead
---
 pom.xml                                            |   8 +-
 .../resolver/bundle/tracker/BundledRenderUnit.java | 145 -------------------
 .../tracker/BundledRenderUnitCapability.java       |  91 ------------
 .../bundle/tracker/BundledRenderUnitFinder.java    |  62 --------
 .../resolver/bundle/tracker/ResourceType.java      | 161 ---------------------
 .../resolver/bundle/tracker/TypeProvider.java      |  45 ------
 .../internal/BundledRenderUnitCapabilityImpl.java  |   4 +-
 .../tracker/internal/BundledScriptServlet.java     |   6 +-
 .../tracker/internal/BundledScriptTracker.java     |  10 +-
 .../bundle/tracker/internal/TypeProviderImpl.java  |   4 +-
 .../tracker/internal/request/RequestWrapper.java   |   2 +-
 .../resolver/bundle/tracker/package-info.java      |  22 ---
 .../resolver/bundle/tracker/ResourceTypeTest.java  |  87 -----------
 .../resolver/it/ServletResolverTestSupport.java    |   1 +
 14 files changed, 21 insertions(+), 627 deletions(-)

diff --git a/pom.xml b/pom.xml
index 98ebac0..c4a0af9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -197,7 +197,13 @@
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.api</artifactId>
-            <version>2.22.0</version>
+            <version>2.23.1-SNAPSHOT</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.scripting.api</artifactId>
+            <version>2.2.1-SNAPSHOT</version>
             <scope>provided</scope>
         </dependency>
         <!-- for ServiceUserMapped (SLING-4312) -->
diff --git 
a/src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/BundledRenderUnit.java
 
b/src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/BundledRenderUnit.java
deleted file mode 100644
index 2c89309..0000000
--- 
a/src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/BundledRenderUnit.java
+++ /dev/null
@@ -1,145 +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.
- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-package org.apache.sling.servlets.resolver.bundle.tracker;
-
-import java.io.InputStream;
-import java.util.Set;
-
-import javax.script.ScriptException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-import org.osgi.annotation.versioning.ConsumerType;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-
-/**
- * <p>
- * A {@code BundledRenderUnit} represents a pre-packaged script or precompiled 
script (Java class) that will be executed in order to
- * render a {@link org.apache.sling.api.SlingHttpServletRequest}.
- * </p>
- * <p>
- * The {@code BundledRenderUnit} provider module is responsible for defining 
how a unit is executed. However, when executing the unit in the
- * context of a {@link javax.script.ScriptEngine}, the provider module should 
add the current executing unit into the {@link
- * javax.script.ScriptEngine}'s {@link javax.script.ScriptContext} using the 
{@link #VARIABLE} key.
- * </p>
- */
-@ConsumerType
-public interface BundledRenderUnit {
-
-    /**
-     * The variable available in the {@link javax.script.Bindings} associated 
to a {@link org.apache.sling.api.SlingHttpServletRequest} if
-     * that request is served by a {@code BundledRenderUnit}.
-     */
-    String VARIABLE = BundledRenderUnit.class.getName();
-
-    /**
-     * In case this {@code BundledRenderUnit} wraps a precompiled script, this 
method will return an instance of that object.
-     *
-     * @return a precompiled unit, if {@code this} unit wraps a precompiled 
script; {@code null} otherwise
-     */
-    @Nullable
-    default Object getUnit() {
-        return null;
-    }
-
-    /**
-     * Returns the name of {@code this BundledRenderUnit}. This can be the 
name of the wrapped script or precompiled script.
-     *
-     * @return the name {@code this BundledRenderUnit}
-     */
-    @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
-     * instantiates a {@link BundledRenderUnit}). This method can be useful 
for getting an instance of the bundle's classloader, when
-     * needed to load dependencies at run-time. To do so the following code 
example can help:
-     *
-     * <pre>
-     * Bundle bundle = bundledRenderUnit.getBundle();
-     * Classloader bundleClassloader = 
bundle.adapt(BundleWiring.class).getClassLoader();
-     * </pre>
-     */
-    @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
-     * context, when needed to load dependencies at run-time.
-     *
-     * @return the bundle context of the bundle publishing this unit
-     */
-    @NotNull BundleContext getBundleContext();
-
-    /**
-     * Returns the {@code Set} of {@link TypeProvider}s which are related to 
this unit.
-     *
-     * @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();
-
-    /**
-     * Retrieves an OSGi runtime dependency of the wrapped script identified 
by the passed {@code className} parameter.
-     *
-     * @param className the fully qualified class name
-     * @param <T>       the expected service type
-     * @return an instance of the {@link T} or {@code null}
-     */
-    @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}
-     * parameter, filtered according to the passed {@code filter}.
-     *
-     * @param className the fully qualified class name
-     * @param filter    a filter expression or {@code null} if all the 
instances should be returned; for more details about the {@code
-     *                  filter}'s syntax check {@link 
org.osgi.framework.BundleContext#getServiceReferences(String, String)}
-     * @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);
-
-    /**
-     * Returns the path of this executable in the resource type hierarchy. The 
path can be relative to the search paths or absolute.
-     *
-     * @return the path of this executable in the resource type hierarchy
-     */
-    @NotNull
-    String getPath();
-
-    /**
-     * This method will execute / evaluate the wrapped script or precompiled 
script with the given request.
-     *
-     * @throws ScriptException if the execution leads to an error
-     */
-    void eval(@NotNull HttpServletRequest request, @NotNull 
HttpServletResponse response) throws ScriptException;
-
-    /**
-     * This method will return an input stream if {@code this} unit is backed 
by a script that can be interpreted.
-     *
-     * @return an {@link InputStream} providing the source code of the backing 
script; if {@code this} unit is backed by a precompiled
-     * script (essentially a Java class), then this method will return {@code 
null}
-     */
-    @Nullable
-    default InputStream getInputStream() {
-        return null;
-    }
-}
diff --git 
a/src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/BundledRenderUnitCapability.java
 
b/src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/BundledRenderUnitCapability.java
deleted file mode 100644
index e0693cb..0000000
--- 
a/src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/BundledRenderUnitCapability.java
+++ /dev/null
@@ -1,91 +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.
- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-package org.apache.sling.servlets.resolver.bundle.tracker;
-
-import java.util.List;
-import java.util.Set;
-
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-import org.osgi.annotation.versioning.ProviderType;
-
-/**
- * A {@code BundledRenderUnitCapability} encapsulates the values of a {@code 
Provided-Capability}, based on which {@link BundledRenderUnit}s
- * are generated.
- */
-@ProviderType
-public interface BundledRenderUnitCapability {
-
-    /**
-     * Returns the resource types to which a {@link BundledRenderUnit} 
described by this capability will be bound to.
-     *
-     * @return the resource types to which a {@link BundledRenderUnit} 
described by this capability will be bound to
-     */
-    @NotNull Set<ResourceType> getResourceTypes();
-
-    /**
-     * Returns the path to which a {@link BundledRenderUnit} described by this 
capability will be bound to.
-     *
-     * @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();
-
-    /**
-     * 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();
-
-    /**
-     * 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();
-
-    /**
-     * Returns the resource type extended by this capability.
-     *
-     * @return the extended resource type or {@code null}
-     */
-    @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();
-
-    /**
-     * 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();
-
-    /**
-     * 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();
-}
diff --git 
a/src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/BundledRenderUnitFinder.java
 
b/src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/BundledRenderUnitFinder.java
deleted file mode 100644
index d632ba8..0000000
--- 
a/src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/BundledRenderUnitFinder.java
+++ /dev/null
@@ -1,62 +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.
- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-package org.apache.sling.servlets.resolver.bundle.tracker;
-
-import java.util.Set;
-
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-import org.osgi.annotation.versioning.ConsumerType;
-import org.osgi.framework.BundleContext;
-
-/**
- * The {@code BundledScriptFinder} finds the {@link BundledRenderUnit} 
corresponding to a certain chain of {@link TypeProvider}s or
- * corresponding to a certain path-based {@link BundledRenderUnitCapability}.
- */
-@ConsumerType
-public interface BundledRenderUnitFinder {
-
-    /**
-     * Retrieves the best matching {@link BundledRenderUnit} for the provided 
{@code inheritanceChain}, by scanning all {@link TypeProvider}
-     * bundles for the class or script capable of providing a rendering for 
resource type chain.
-     *
-     * @param context             the bundle context to use.
-     * @param inheritanceChain    the resource type chain; the set is ordered 
from the most specific resource type to the most generic one
-     * @param allRelatedProviders this is a super set, containing both the 
{@code inheritanceChain} but also all the required providers; a
-     *                            required provider is a provider that's 
needed by a {@link ResourceType} in order to delegate rendering to
-     *                            it, but it's not extended by the same {@link 
ResourceType}
-     * @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);
-
-    /**
-     * Retrieves a path-based {@link BundledRenderUnit} from the passed {@code 
provider}.
-     *
-     * @param context             the bundle context to use.
-     * @param provider            the provider from which to retrieve the unit
-     * @param allRelatedProviders this is a super set, containing both the 
providers connected through an inheritance relationship but also
-     *                            all the required providers; a required 
provider is a provider that's needed by a {@link ResourceType} in
-     *                            order to delegate rendering to it, but it's 
not extended by the same {@link ResourceType}
-     * @return a {@link BundledRenderUnit} if one was found, {@code null} 
otherwise
-     * @see BundledRenderUnitCapability#getPath()
-     */
-    @Nullable
-    BundledRenderUnit findUnit(@NotNull BundleContext context, @NotNull 
TypeProvider provider, @NotNull Set<TypeProvider> allRelatedProviders);
-}
diff --git 
a/src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/ResourceType.java
 
b/src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/ResourceType.java
deleted file mode 100644
index 0f2929e..0000000
--- 
a/src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/ResourceType.java
+++ /dev/null
@@ -1,161 +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.
- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-package org.apache.sling.servlets.resolver.bundle.tracker;
-
-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;
-
-/**
- * The {@code ResourceType} encapsulates details about a Sling resource type 
and provides methods for parsing resource type strings.
- *
- * <p>The following patterns are supported for parsing:</p>
- * <ol>
- * <li><tt>a/b/c</tt> - path-based</li>
- * <li><tt>a/b/c/1.0.0</tt> - path-based, versioned</li>
- * <li><tt>a.b.c</tt> - Java package name</li>
- * <li><tt>a.b.c/1.0.0</tt> - Java package name, versioned</li>
- * <li><tt>a</tt> - flat (sub-set of path-based)</li>
- * </ol>
- */
-public final class ResourceType {
-
-    private static final Pattern versionPattern = 
Pattern.compile("[\\d\\.]+(-.*)*$");
-
-    private final String type;
-    private final String version;
-    private final String resourceLabel;
-    private final String toString;
-
-    private ResourceType(@NotNull String type, @Nullable String version) {
-        this.type = type;
-        this.version = version;
-        if (type.lastIndexOf('/') != -1) {
-            resourceLabel = type.substring(type.lastIndexOf('/') + 1);
-        } else if (type.lastIndexOf('.') != -1) {
-            resourceLabel = type.substring(type.lastIndexOf('.') + 1);
-        } else {
-            resourceLabel = type;
-        }
-        toString = type + (version == null ? "" : "/" + version);
-    }
-
-    /**
-     * Returns a resource type's label. The label is important for script 
selection, since it will provide the name of the main script
-     * for this resource type. For more details check the Apache Sling
-     * <a 
href="https://sling.apache.org/documentation/the-sling-engine/url-to-script-resolution.html#scripts-for-get-requests";>URL
 to
-     * Script Resolution</a> page
-     *
-     * @return the resource type label
-     */
-    @NotNull
-    public String getResourceLabel() {
-        return resourceLabel;
-    }
-
-    /**
-     * Returns the resource type string, without any version information.
-     *
-     * @return the resource type string
-     */
-    @NotNull
-    public String getType() {
-        return type;
-    }
-
-    /**
-     * Returns the version, if available.
-     *
-     * @return the version, if available; {@code null} otherwise
-     */
-    @Nullable
-    public String getVersion() {
-        return version;
-    }
-
-    @Override
-    public String toString() {
-        return toString;
-    }
-
-    /**
-     * Given a {@code resourceTypeString}, this method will extract a {@link 
ResourceType} object.
-     * <p>The accepted patterns are:</p>
-     * <ol>
-     * <li><tt>a/b/c</tt> - path-based</li>
-     * <li><tt>a/b/c/1.0.0</tt> - path-based, versioned</li>
-     * <li><tt>a.b.c</tt> - Java package name</li>
-     * <li><tt>a.b.c/1.0.0</tt> - Java package name, versioned</li>
-     * <li><tt>a</tt> - flat (sub-set of path-based)</li>
-     * </ol>
-     *
-     * @param resourceTypeString the resource type string to parse
-     * @return a {@link ResourceType} object
-     * @throws IllegalArgumentException if the {@code resourceTypeString} 
cannot be parsed
-     */
-    @NotNull
-    public static ResourceType parseResourceType(@NotNull String 
resourceTypeString) {
-        String type = StringUtils.EMPTY;
-        String version = null;
-        if (StringUtils.isNotEmpty(resourceTypeString)) {
-            int lastSlash = resourceTypeString.lastIndexOf('/');
-            if (lastSlash != -1 && !resourceTypeString.endsWith("/")) {
-                String versionString = resourceTypeString.substring(lastSlash 
+ 1);
-                if (versionPattern.matcher(versionString).matches()) {
-                    try {
-                        version = 
Version.parseVersion(versionString).toString();
-                        type = resourceTypeString.substring(0, lastSlash);
-                    } catch (IllegalArgumentException e) {
-                        type = resourceTypeString;
-                    }
-                } else {
-                    type = resourceTypeString;
-                }
-            } else {
-                type = resourceTypeString;
-            }
-        }
-        if (StringUtils.isEmpty(type)) {
-            throw new IllegalArgumentException(String.format("Cannot extract a 
type for the resourceTypeString %s.", resourceTypeString));
-        }
-        return new ResourceType(type, version);
-    }
-
-    @Override
-    public int hashCode() {
-        return Objects.hash(type, version, resourceLabel);
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        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 false;
-    }
-}
diff --git 
a/src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/TypeProvider.java
 
b/src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/TypeProvider.java
deleted file mode 100644
index 7e36d7d..0000000
--- 
a/src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/TypeProvider.java
+++ /dev/null
@@ -1,45 +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.
- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-package org.apache.sling.servlets.resolver.bundle.tracker;
-
-import org.jetbrains.annotations.NotNull;
-import org.osgi.annotation.versioning.ProviderType;
-import org.osgi.framework.Bundle;
-
-/**
- * A {@code TypeProvider} keeps an association between a {@link 
BundledRenderUnitCapability} and the bundle that provides it.
- */
-@ProviderType
-public interface TypeProvider {
-
-    /**
-     * Returns the {@link BundledRenderUnitCapability}.
-     *
-     * @return the {@link BundledRenderUnitCapability}
-     */
-    @NotNull BundledRenderUnitCapability getBundledRenderUnitCapability();
-
-    /**
-     * Returns the providing bundle.
-     *
-     * @return the providing bundle
-     */
-    @NotNull Bundle getBundle();
-
-}
diff --git 
a/src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/internal/BundledRenderUnitCapabilityImpl.java
 
b/src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/internal/BundledRenderUnitCapabilityImpl.java
index 1d68f8e..8cf1753 100644
--- 
a/src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/internal/BundledRenderUnitCapabilityImpl.java
+++ 
b/src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/internal/BundledRenderUnitCapabilityImpl.java
@@ -26,10 +26,10 @@ import java.util.Map;
 import java.util.Objects;
 import java.util.Set;
 
+import org.apache.sling.api.resource.type.ResourceType;
 import org.apache.sling.api.servlets.ServletResolverConstants;
 import org.apache.sling.commons.osgi.PropertiesUtil;
-import 
org.apache.sling.servlets.resolver.bundle.tracker.BundledRenderUnitCapability;
-import org.apache.sling.servlets.resolver.bundle.tracker.ResourceType;
+import org.apache.sling.scripting.api.bundle.BundledRenderUnitCapability;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 import org.osgi.framework.Version;
diff --git 
a/src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/internal/BundledScriptServlet.java
 
b/src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/internal/BundledScriptServlet.java
index f8102b1..41fad37 100644
--- 
a/src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/internal/BundledScriptServlet.java
+++ 
b/src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/internal/BundledScriptServlet.java
@@ -33,9 +33,9 @@ import javax.servlet.ServletResponse;
 import org.apache.sling.api.SlingConstants;
 import org.apache.sling.api.SlingHttpServletRequest;
 import org.apache.sling.api.SlingHttpServletResponse;
-import org.apache.sling.servlets.resolver.bundle.tracker.BundledRenderUnit;
-import org.apache.sling.servlets.resolver.bundle.tracker.ResourceType;
-import org.apache.sling.servlets.resolver.bundle.tracker.TypeProvider;
+import org.apache.sling.api.resource.type.ResourceType;
+import org.apache.sling.scripting.api.bundle.BundledRenderUnit;
+import org.apache.sling.scripting.api.bundle.TypeProvider;
 import 
org.apache.sling.servlets.resolver.bundle.tracker.internal.request.RequestWrapper;
 import org.jetbrains.annotations.NotNull;
 
diff --git 
a/src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/internal/BundledScriptTracker.java
 
b/src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/internal/BundledScriptTracker.java
index 2831a23..4cd7f71 100644
--- 
a/src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/internal/BundledScriptTracker.java
+++ 
b/src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/internal/BundledScriptTracker.java
@@ -53,14 +53,14 @@ import org.apache.sling.api.SlingHttpServletRequest;
 import org.apache.sling.api.SlingHttpServletResponse;
 import org.apache.sling.api.request.RequestDispatcherOptions;
 import org.apache.sling.api.resource.ResourceUtil;
+import org.apache.sling.api.resource.type.ResourceType;
 import org.apache.sling.api.servlets.HttpConstants;
 import org.apache.sling.api.servlets.ServletResolverConstants;
 import org.apache.sling.commons.osgi.PropertiesUtil;
-import org.apache.sling.servlets.resolver.bundle.tracker.BundledRenderUnit;
-import 
org.apache.sling.servlets.resolver.bundle.tracker.BundledRenderUnitCapability;
-import 
org.apache.sling.servlets.resolver.bundle.tracker.BundledRenderUnitFinder;
-import org.apache.sling.servlets.resolver.bundle.tracker.ResourceType;
-import org.apache.sling.servlets.resolver.bundle.tracker.TypeProvider;
+import org.apache.sling.scripting.api.bundle.BundledRenderUnit;
+import org.apache.sling.scripting.api.bundle.BundledRenderUnitCapability;
+import org.apache.sling.scripting.api.bundle.BundledRenderUnitFinder;
+import org.apache.sling.scripting.api.bundle.TypeProvider;
 import org.apache.sling.servlets.resolver.internal.resource.ServletMounter;
 import org.jetbrains.annotations.NotNull;
 import org.osgi.annotation.bundle.Capability;
diff --git 
a/src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/internal/TypeProviderImpl.java
 
b/src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/internal/TypeProviderImpl.java
index 63c67cf..f61b14f 100644
--- 
a/src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/internal/TypeProviderImpl.java
+++ 
b/src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/internal/TypeProviderImpl.java
@@ -20,8 +20,8 @@ package 
org.apache.sling.servlets.resolver.bundle.tracker.internal;
 
 import java.util.Objects;
 
-import 
org.apache.sling.servlets.resolver.bundle.tracker.BundledRenderUnitCapability;
-import org.apache.sling.servlets.resolver.bundle.tracker.TypeProvider;
+import org.apache.sling.scripting.api.bundle.BundledRenderUnitCapability;
+import org.apache.sling.scripting.api.bundle.TypeProvider;
 import org.jetbrains.annotations.NotNull;
 import org.osgi.framework.Bundle;
 
diff --git 
a/src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/internal/request/RequestWrapper.java
 
b/src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/internal/request/RequestWrapper.java
index 5e20069..7c13d40 100644
--- 
a/src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/internal/request/RequestWrapper.java
+++ 
b/src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/internal/request/RequestWrapper.java
@@ -26,8 +26,8 @@ import org.apache.commons.lang3.StringUtils;
 import org.apache.sling.api.SlingHttpServletRequest;
 import org.apache.sling.api.request.RequestDispatcherOptions;
 import org.apache.sling.api.resource.Resource;
+import org.apache.sling.api.resource.type.ResourceType;
 import org.apache.sling.api.wrappers.SlingHttpServletRequestWrapper;
-import org.apache.sling.servlets.resolver.bundle.tracker.ResourceType;
 
 public class RequestWrapper extends SlingHttpServletRequestWrapper {
 
diff --git 
a/src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/package-info.java
 
b/src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/package-info.java
deleted file mode 100644
index 91b289b..0000000
--- 
a/src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/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("0.2.0")
-package org.apache.sling.servlets.resolver.bundle.tracker;
-
-import org.osgi.annotation.versioning.Version;
diff --git 
a/src/test/java/org/apache/sling/servlets/resolver/bundle/tracker/ResourceTypeTest.java
 
b/src/test/java/org/apache/sling/servlets/resolver/bundle/tracker/ResourceTypeTest.java
deleted file mode 100644
index 5464bd1..0000000
--- 
a/src/test/java/org/apache/sling/servlets/resolver/bundle/tracker/ResourceTypeTest.java
+++ /dev/null
@@ -1,87 +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.
- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-package org.apache.sling.servlets.resolver.bundle.tracker;
-
-import org.apache.commons.lang3.StringUtils;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-
-public class ResourceTypeTest {
-
-    @Test
-    public void testSlashNoVersion() {
-        ResourceType t1 = ResourceType.parseResourceType("a/b/c");
-        assertEquals("a/b/c", t1.getType());
-        assertEquals("c", t1.getResourceLabel());
-        assertNull(t1.getVersion());
-    }
-
-    @Test
-    public void testSlashVersion() {
-        ResourceType t1 = ResourceType.parseResourceType("a/b/c/1.0.0");
-        assertEquals("a/b/c", t1.getType());
-        assertEquals("c", t1.getResourceLabel());
-        assertEquals("1.0.0", t1.getVersion());
-    }
-
-    @Test
-    public void testOneSegmentNoVersion() {
-        ResourceType t1 = ResourceType.parseResourceType("a");
-        assertEquals("a", t1.getType());
-        assertEquals("a", t1.getResourceLabel());
-        assertNull(t1.getVersion());
-    }
-
-    @Test
-    public void testOneSegmentVersion() {
-        ResourceType t1 = ResourceType.parseResourceType("a/1.2.3");
-        assertEquals("a", t1.getType());
-        assertEquals("a", t1.getResourceLabel());
-        assertEquals("1.2.3", t1.getVersion());
-    }
-
-    @Test
-    public void testDotNoVersion() {
-        ResourceType t1 = ResourceType.parseResourceType("a.b.c");
-        assertEquals("a.b.c", t1.getType());
-        assertEquals("c", t1.getResourceLabel());
-        assertNull(t1.getVersion());
-    }
-
-    @Test
-    public void testDotVersion() {
-        ResourceType t1 = ResourceType.parseResourceType("a.b.c/42.0.0");
-        assertEquals("a.b.c", t1.getType());
-        assertEquals("c", t1.getResourceLabel());
-        assertEquals("42.0.0", t1.getVersion());
-    }
-
-    @Test(expected = IllegalArgumentException.class)
-    public void testEmptyString() {
-        ResourceType t1 = ResourceType.parseResourceType(StringUtils.EMPTY);
-    }
-
-    @Test(expected = IllegalArgumentException.class)
-    public void testNull() {
-        ResourceType t1 = ResourceType.parseResourceType(null);
-    }
-
-}
diff --git 
a/src/test/java/org/apache/sling/servlets/resolver/it/ServletResolverTestSupport.java
 
b/src/test/java/org/apache/sling/servlets/resolver/it/ServletResolverTestSupport.java
index 405caa7..046ca84 100644
--- 
a/src/test/java/org/apache/sling/servlets/resolver/it/ServletResolverTestSupport.java
+++ 
b/src/test/java/org/apache/sling/servlets/resolver/it/ServletResolverTestSupport.java
@@ -76,6 +76,7 @@ public class ServletResolverTestSupport extends TestSupport {
         final String vmOpt = System.getProperty("pax.vm.options");
         versionResolver.setVersionFromProject("org.apache.sling", 
"org.apache.sling.api");
         versionResolver.setVersionFromProject("org.apache.sling", 
"org.apache.sling.resourceresolver");
+        versionResolver.setVersionFromProject("org.apache.sling", 
"org.apache.sling.scripting.api");
         versionResolver.setVersionFromProject("org.apache.sling", 
"org.apache.sling.scripting.core");
         return options(
             composite(

Reply via email to