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: SLING-8849 Added a ConfigurationBindingsResourceDetectionStrategy that can be used to detect a Resource based on the provided bindings
Date Mon, 06 Jan 2020 16:31:48 GMT
stefanseifert commented on a change in pull request #1: SLING-8849 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_r363371960
 
 

 ##########
 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:
   then we should use SlingHttpServletRequest  as parameter.
   for an AEM specific strategy implementation it would be no problem getting the sling bindings
from the request and reading the current page from it.
   it's more flexible than directly passing in the Bindings object.

----------------------------------------------------------------
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