From dev-return-101923-archive-asf-public=cust-asf.ponee.io@sling.apache.org Mon Jan 6 16:31:49 2020 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id 20858180636 for ; Mon, 6 Jan 2020 17:31:49 +0100 (CET) Received: (qmail 79015 invoked by uid 500); 6 Jan 2020 16:31:48 -0000 Mailing-List: contact dev-help@sling.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@sling.apache.org Delivered-To: mailing list dev@sling.apache.org Received: (qmail 79003 invoked by uid 99); 6 Jan 2020 16:31:48 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 06 Jan 2020 16:31:48 +0000 From: GitBox To: dev@sling.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 Message-ID: <157832830825.28734.6744796936581292077.gitbox@gitbox.apache.org> References: In-Reply-To: Date: Mon, 06 Jan 2020 16:31:48 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit 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