You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by GitBox <gi...@apache.org> on 2022/01/14 15:26:21 UTC

[GitHub] [sling-org-apache-sling-jcr-resource] kwin commented on a change in pull request #19: SLING-11061 URIProvider for resources backed by JCR BinaryDownload

kwin commented on a change in pull request #19:
URL: https://github.com/apache/sling-org-apache-sling-jcr-resource/pull/19#discussion_r784933096



##########
File path: src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/BinaryDownloadUriProvider.java
##########
@@ -0,0 +1,142 @@
+/*
+ * 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.jcr.resource.internal.helper.jcr;
+
+import java.net.URI;
+
+import javax.jcr.Binary;
+import javax.jcr.ItemNotFoundException;
+import javax.jcr.Node;
+import javax.jcr.Property;
+import javax.jcr.RepositoryException;
+import javax.jcr.ValueFormatException;
+
+import org.apache.jackrabbit.api.binary.BinaryDownload;
+import org.apache.jackrabbit.api.binary.BinaryDownloadOptions;
+import org.apache.jackrabbit.api.binary.BinaryDownloadOptions.BinaryDownloadOptionsBuilder;
+import org.apache.sling.api.resource.Resource;
+import org.apache.sling.api.resource.external.URIProvider;
+import org.apache.sling.jcr.resource.internal.helper.jcr.BinaryDownloadUriProvider.Configuration.ContentDisposition;
+import org.jetbrains.annotations.NotNull;
+import org.osgi.service.component.annotations.Activate;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.ConfigurationPolicy;
+import org.osgi.service.metatype.annotations.AttributeDefinition;
+import org.osgi.service.metatype.annotations.Designate;
+import org.osgi.service.metatype.annotations.ObjectClassDefinition;
+
+/**
+ * Provides URIs for direct binary read-access based on the Jackrabbit API {@link BinaryDownload}.
+ * 
+ * @see <a href="https://jackrabbit.apache.org/oak/docs/features/direct-binary-access.html">Oak Direct Binary Access</a>
+ *
+ */
+@Component(service = URIProvider.class, configurationPolicy = ConfigurationPolicy.REQUIRE)
+@Designate(ocd = BinaryDownloadUriProvider.Configuration.class)
+public class BinaryDownloadUriProvider implements URIProvider {

Review comment:
       I am not sure I follow this argument. I placed it in this bundle, because that already depends on Jackrabbit API and one method is shared between this and the `JcrNodeResource` (for getting the primary property). Anyone can easily override that by registering a service with a higher rank, also this service is only becoming active if it has been configured. 
   
   > I am expecting it to change in the future.
   
   The Jackrabbit API is stable, evolvements in the future will most probably be backwards compatible. Also given that this API has been introduced in July 2018 (https://issues.apache.org/jira/browse/JCR-4335) and never been changed since than, I don't see it being too volatile...
   
   What do you want to gain with separating bundles? Just different release cycles or is there anything else I don't see?




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

To unsubscribe, e-mail: dev-unsubscribe@sling.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org