sling-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [sling-org-apache-sling-caconfig-spi] stefanseifert commented on a change in pull request #1: Added a ConfigurationBindingsResourceDetectionStrategy that can be used to detect a Resource based on the provided bindings
Date Fri, 15 Nov 2019 17:33:27 GMT
stefanseifert commented on a change in pull request #1: Added a ConfigurationBindingsResourceDetectionStrategy
that can be used to detect a Resource based on the provided bindings
URL: https://github.com/apache/sling-org-apache-sling-caconfig-spi/pull/1#discussion_r346933171
 
 

 ##########
 File path: src/main/java/org/apache/sling/caconfig/resource/spi/ConfigurationBindingsResourceDetectionStrategy.java
 ##########
 @@ -0,0 +1,36 @@
+/*
+ * 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.caconfig.resource.spi;
+
+import org.apache.sling.api.resource.Resource;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+import org.osgi.annotation.versioning.ConsumerType;
+
+import javax.script.Bindings;
+
+@ConsumerType
+public interface ConfigurationBindingsResourceDetectionStrategy {
+    /**
+     * Detects the resource by looking at the available bindings.
+     * @param bindings Bindings object to use for detecting the correct Resource.
+     * @return Detected Resource or {@code null} if this strategy did not detect an applicable
resource.
+     */
+    @Nullable Resource detectResource(@NotNull Bindings bindings);
 
 Review comment:
   i would prefer not using the Bindings class as input parameter here - maybe better SlingHttpServletRequest
or even better the current resource of the current request. it might be that we want to use
this interface as well for [SLING-7256|https://issues.apache.org/jira/browse/SLING-7256],
the use case is a bit similar when injecting the fitting configuration in a sling model).
so Resource might fit best?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message