Re: OAK-6575 - Provide a secure external URL to a DataStore binary.

2017-08-24 Thread Ian Boston
On 24 August 2017 at 14:42, Michael Dürig wrote: > > > On 24.08.17 15:33, Chetan Mehrotra wrote: > >> Inside Oak it would have its own version of an AdapterManager, >>> AdapterFactory. the DataStore would implement an AdapterFactory and >>> register it with the

Re: OAK-6575 - Provide a secure external URL to a DataStore binary.

2017-08-24 Thread Michael Dürig
On 24.08.17 15:33, Chetan Mehrotra wrote: Inside Oak it would have its own version of an AdapterManager, AdapterFactory. the DataStore would implement an AdapterFactory and register it with the AdapterManager. The OakConversionService implementation would then use the AdapterManager to perform

Re: OAK-6575 - Provide a secure external URL to a DataStore binary.

2017-08-24 Thread Chetan Mehrotra
> Inside Oak it would have its own version of an AdapterManager, > AdapterFactory. the DataStore would implement an AdapterFactory and > register it with the AdapterManager. The OakConversionService > implementation would then use the AdapterManager to perform the conversion. > If no

Re: OAK-6575 - Provide a secure external URL to a DataStore binary.

2017-08-24 Thread Ian Boston
Hi, I am probably not helping as here as there are several layers and I think they are getting confused between what I am thinking and what you are thinking. I was thinking Oak exposed a service to convert along the lines of the OSCi converter service or the OakConversionService suggested

Re: OAK-6575 - Provide a secure external URL to a DataStore binary.

2017-08-24 Thread Michael Dürig
On 24.08.17 14:47, Chetan Mehrotra wrote: Which circles back to my initial concern: "According to YAGNI we should stick with instance of checks unless we already have a somewhat clear picture of future extensions." I thought that with all those discussion around JCR Usecases for past some

Re: OAK-6575 - Provide a secure external URL to a DataStore binary.

2017-08-24 Thread Chetan Mehrotra
> Which circles back to my initial concern: "According to YAGNI we should stick > with instance of checks unless we already have a somewhat clear picture of > future extensions." I thought that with all those discussion around JCR Usecases for past some time we have an agreement for such cases

Re: OAK-6575 - Provide a secure external URL to a DataStore binary.

2017-08-24 Thread Michael Dürig
On 24.08.17 14:32, Chetan Mehrotra wrote: Why not just add a method Blob.getSignedURI()? This would be inline with getReference() and what we have done with ReferenceBinary. Can be done. But later if we decide to support adapting to say FileChannel [1] then would we be adding that to Blob.

Re: OAK-6575 - Provide a secure external URL to a DataStore binary.

2017-08-24 Thread Michael Dürig
On 24.08.17 13:54, Ian Boston wrote: You could just jump to URI uri = adapterManager.getAdapter(binary, URI.class); No API changes to any existing Oak APIs, +1, I think this is what we should aim for. Michael

Re: OAK-6575 - Provide a secure external URL to a DataStore binary.

2017-08-24 Thread Chetan Mehrotra
> No API changes to any existing Oak APIs, Some API needs to be exposed. Note again Oak does not depend on Sling API. Any such integration code is implemented in Sling Base module [1]. But that module would still require some API in Oak to provide such an adaptor The adaptor proposal here is for

Re: OAK-6575 - Provide a secure external URL to a DataStore binary.

2017-08-24 Thread Ian Boston
>From the javadoc in [1] "The adaptable object may be any non-null object and is not required to implement the Adaptable interface." On 24 August 2017 at 12:54, Ian Boston wrote: > Hi, > That would require javax.jcr.Binary to implement Adaptable, which it cant. > (OakBinary

Re: OAK-6575 - Provide a secure external URL to a DataStore binary.

2017-08-24 Thread Ian Boston
Hi, That would require javax.jcr.Binary to implement Adaptable, which it cant. (OakBinary could but it doesnt need to). Using Sling AdapterFactory/AdapterManger javadoc (to be replaced with Oaks internal version of the same) What is needed is an AdapterFactory for javax.jcr.Binary to

Re: OAK-6575 - Provide a secure external URL to a DataStore binary.

2017-08-24 Thread Chetan Mehrotra
> 1. Figure out how to surface a signed URL from the DataStore to the > level of the JCR (or Oak) API. > 2. Provide OSGi glue inside Sling, possibly exposing the signed URL it > via adaptTo(). Thats sums up the requirement well. Most of proposal here is for #1. Once we have that implemented #2

Re: OAK-6575 - Provide a secure external URL to a DataStore binary.

2017-08-24 Thread Chetan Mehrotra
> various layers involved. The bit I don't understand is how the adaptable > pattern would make those go away. To me that pattern is just another way to > implement this but it would also need to deal with all those layers. Yes this adapter support would need to be implement at all layers. So

Re: OAK-6575 - Provide a secure external URL to a DataStore binary.

2017-08-24 Thread Ian Boston
Hi, On 24 August 2017 at 10:20, Julian Sedding wrote: > Hi > > On Thu, Aug 24, 2017 at 9:27 AM, Ian Boston wrote: > > On 24 August 2017 at 08:18, Michael Dürig wrote: > > > >> > >> > >> URI uri = ((OakValueFactory)

Re: OAK-6575 - Provide a secure external URL to a DataStore binary.

2017-08-24 Thread Michael Dürig
I understand the difficulties involved with implementing this due to the various layers involved. The bit I don't understand is how the adaptable pattern would make those go away. To me that pattern is just another way to implement this but it would also need to deal with all those layers.

Re: OAK-6575 - Provide a secure external URL to a DataStore binary.

2017-08-24 Thread Tommaso Teofili
Il giorno gio 24 ago 2017 alle ore 10:16 Michael Dürig ha scritto: > > > On 24.08.17 09:27, Ian Boston wrote: > > On 24 August 2017 at 08:18, Michael Dürig wrote: > > > >> > >> > >> URI uri = ((OakValueFactory) valueFactory).getSignedURI(binProp); > >> >

Re: OAK-6575 - Provide a secure external URL to a DataStore binary.

2017-08-24 Thread Chetan Mehrotra
As explained in previous mail adaptable pattern requirement is to enable such a support within Oak itself. due to multiple layers involved. > If it doesnt exist then perhaps Oak could add a Service interface that > deals with conversions, rather than expose a second adaptable pattern in > Sling,

Re: OAK-6575 - Provide a secure external URL to a DataStore binary.

2017-08-24 Thread Ian Boston
On 24 August 2017 at 09:16, Michael Dürig wrote: > > > On 24.08.17 09:27, Ian Boston wrote: > >> On 24 August 2017 at 08:18, Michael Dürig wrote: >> >> >>> >>> URI uri = ((OakValueFactory) valueFactory).getSignedURI(binProp); >>> >>> >>> +1 >> >> One

Re: OAK-6575 - Provide a secure external URL to a DataStore binary.

2017-08-24 Thread Michael Dürig
On 24.08.17 09:27, Ian Boston wrote: On 24 August 2017 at 08:18, Michael Dürig wrote: URI uri = ((OakValueFactory) valueFactory).getSignedURI(binProp); +1 One point Users in Sling dont know abou Oak, they know about JCR. URI uri = ((OakValueFactory)

Re: OAK-6575 - Provide a secure external URL to a DataStore binary.

2017-08-24 Thread Ian Boston
The datastore should understand how to go from Blob -> URI. In the case of S3 it does and uses Blob.getContentId(). If the datastore doesnt know how to do it, then its not supported by the datastore. You might need a DataStore.getSignedURI(Blob b) method. On 24 August 2017 at 08:27, Chetan

Re: OAK-6575 - Provide a secure external URL to a DataStore binary.

2017-08-24 Thread Ian Boston
On 24 August 2017 at 08:18, Michael Dürig wrote: > > > URI uri = ((OakValueFactory) valueFactory).getSignedURI(binProp); > > +1 One point Users in Sling dont know abou Oak, they know about JCR. URI uri = ((OakValueFactory)

Re: OAK-6575 - Provide a secure external URL to a DataStore binary.

2017-08-24 Thread Chetan Mehrotra
> Fair point. So this is more about dynamic adaptability than future > extendibility. But AFIU this could still be achieved without the full > adaptable machinery: > > if (binProp instanceOf SignableBin) { > URI uri = ((SignableBin) binProp).getSignedURI(); > if (uri != null) { > //

Re: OAK-6575 - Provide a secure external URL to a DataStore binary.

2017-08-24 Thread Michael Dürig
On 24.08.17 09:06, Chetan Mehrotra wrote: I think the discussion about the adapter pattern is orthogonal to the binary For me its tied to how you are going to implement this support. Adaptable patterns is one way based on my current understand of Oak design. At level of

Re: OAK-6575 - Provide a secure external URL to a DataStore binary.

2017-08-24 Thread Chetan Mehrotra
> I think the discussion about the adapter pattern is orthogonal to the binary For me its tied to how you are going to implement this support. Adaptable patterns is one way based on my current understand of Oak design. At level of ValueFactory.getBinary we do not know if the Blob can provide a

Re: OAK-6575 - Provide a secure external URL to a DataStore binary.

2017-08-24 Thread Michael Dürig
Hi, I think the discussion about the adapter pattern is orthogonal to the binary issue. According to YAGNI we should stick with instance of checks unless we already have a somewhat clear picture of future extensions. Michael On 24.08.17 07:28, Chetan Mehrotra wrote: Based on the feedback

Re: OAK-6575 - Provide a secure external URL to a DataStore binary.

2017-08-24 Thread Amit Jain
Hi, +1 from my side for the broad contours as proposed above. Thanks Amit On Thu, Aug 24, 2017 at 10:58 AM, Chetan Mehrotra wrote: > Based on the feedback so far below is revised proposal > > 1. Define a new Adaptable interface in 'org.apache.jackrabbit.oak.api' >

Re: OAK-6575 - Provide a secure external URL to a DataStore binary.

2017-08-23 Thread Julian Reschke
On 2017-08-23 13:39, Chetan Mehrotra wrote: Below is one possible sketch of the proposed api. We introduce a new AdaptableBinary which allows adapting a Binary to some other form. API === public interface AdaptableBinary { /** * Adapts the binary to another type * *

Re: OAK-6575 - Provide a secure external URL to a DataStore binary.

2017-08-23 Thread Chetan Mehrotra
Below is one possible sketch of the proposed api. We introduce a new AdaptableBinary which allows adapting a Binary to some other form. API === public interface AdaptableBinary { /** * Adapts the binary to another type * * @param The generic type to which this binary is