CMIS UCP extension

classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

CMIS UCP extension

Dan Corneanu
Hi,
I have managed to write a skeleton implementation of a UCP in java and
registered it to handle the "cmis" schema. My URI looks like this
"cmis:///foo/bar#http://a.serve.com/cmis" and as far as I know this is a
valid hierarchical URI.

If I try to open this URL by putting it in the "Load Url" command from
the toolbar, my UCP createContentIdentifier() gets called with
"cmis:///foo/bar".

Why is the fragment part removed from the URI ?

--
Dan Corneanu
Sava Technologies SRL
Eroilor de la Tisa nr. 33
300553 Timisoara
Romania

Phone: +40 256 201269, +40 356 101412
Mobile: +40 721 723604
E-mail: [hidden email]
http://www.savatech.ro

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: CMIS UCP extension

stephan.bergmann
On 05/19/10 09:58, Dan Corneanu wrote:

> I have managed to write a skeleton implementation of a UCP in java and
> registered it to handle the "cmis" schema. My URI looks like this
> "cmis:///foo/bar#http://a.serve.com/cmis" and as far as I know this is a
> valid hierarchical URI.
>
> If I try to open this URL by putting it in the "Load Url" command from
> the toolbar, my UCP createContentIdentifier() gets called with
> "cmis:///foo/bar".
>
> Why is the fragment part removed from the URI ?

RFC 3986: "[...] the fragment identifier is not used in the
scheme-specific processing of a URI; instead, the fragment identifier is
separated from the rest of the URI prior to a dereference, and thus the
identifying information within the fragment itself is dereferenced
solely by the user agent, regardless of the URI scheme."

(By the way, is that cmis URI scheme something you cooked up privately,
or is there some initiative to register it with IANA?)

-Stephan

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: CMIS UCP extension

Kai Sommerfeld
In reply to this post by Dan Corneanu
Hi Dan,

  adding CMIS support to UCB would be a very valuable functional
enhancement for OOo. Do you plan to contribute your work back to the OOo
source repository?

- Kai.

On 19.05.10 09:58, Dan Corneanu wrote:

> Hi,
> I have managed to write a skeleton implementation of a UCP in java and
> registered it to handle the "cmis" schema. My URI looks like this
> "cmis:///foo/bar#http://a.serve.com/cmis" and as far as I know this is a
> valid hierarchical URI.
>
> If I try to open this URL by putting it in the "Load Url" command from
> the toolbar, my UCP createContentIdentifier() gets called with
> "cmis:///foo/bar".
>
> Why is the fragment part removed from the URI ?
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: CMIS UCP extension

Dan Corneanu
On 5/19/2010 11:52 AM, Kai Sommerfeld wrote:
> Hi Dan,
>
>  adding CMIS support to UCB would be a very valuable functional
> enhancement for OOo. Do you plan to contribute your work back to the
> OOo source repository?
>
> - Kai.
>
If I manage to write a java based UCP able to read/write a given
document in CMIS then I surely contribute it as open source.
Currently the cmis UCP registeres itself, gets called for "cmis:"
schemas, knows how to talk with a CMIS repository and fetch object
properties, but I have some hard times implementing the "open" command.

Unfortunately all existing implementations are in C++.

> On 19.05.10 09:58, Dan Corneanu wrote:
>> Hi,
>> I have managed to write a skeleton implementation of a UCP in java and
>> registered it to handle the "cmis" schema. My URI looks like this
>> "cmis:///foo/bar#http://a.serve.com/cmis" and as far as I know this is a
>> valid hierarchical URI.
>>
>> If I try to open this URL by putting it in the "Load Url" command from
>> the toolbar, my UCP createContentIdentifier() gets called with
>> "cmis:///foo/bar".
>>
>> Why is the fragment part removed from the URI ?
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
>


--
Dan Corneanu
Sava Technologies SRL
Eroilor de la Tisa nr. 33
300553 Timisoara
Romania

Phone: +40 256 201269, +40 356 101412
Mobile: +40 721 723604
E-mail: [hidden email]
http://www.savatech.ro


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: CMIS UCP extension

Dan Corneanu
In reply to this post by stephan.bergmann
On 5/19/2010 11:15 AM, Stephan Bergmann wrote:

> On 05/19/10 09:58, Dan Corneanu wrote:
>> I have managed to write a skeleton implementation of a UCP in java and
>> registered it to handle the "cmis" schema. My URI looks like this
>> "cmis:///foo/bar#http://a.serve.com/cmis" and as far as I know this is a
>> valid hierarchical URI.
>>
>> If I try to open this URL by putting it in the "Load Url" command from
>> the toolbar, my UCP createContentIdentifier() gets called with
>> "cmis:///foo/bar".
>>
>> Why is the fragment part removed from the URI ?
>
> RFC 3986: "[...] the fragment identifier is not used in the
> scheme-specific processing of a URI; instead, the fragment identifier
> is separated from the rest of the URI prior to a dereference, and thus
> the identifying information within the fragment itself is dereferenced
> solely by the user agent, regardless of the URI scheme."
>
> (By the way, is that cmis URI scheme something you cooked up
> privately, or is there some initiative to register it with IANA?)
>
Thx, for the information.
The URI was privately cooked for my implementation. Any suggestions for
a proper URI schema are welcomed.
I need a schema for a hierarchical URI that can specify the path to a
given document on a CMIS repository along with the URL to the CMIS
webservices deployed on the repository.

Ex. cmis:///foo/bar#http://a.serve.com/cmis
cmis - cmis URI schema identifier
/foo/bar - the path to the document starting from the repository's root
http://a.serve.com/cmis - the URI to the repository server

> -Stephan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
>


--
Dan Corneanu
Sava Technologies SRL
Eroilor de la Tisa nr. 33
300553 Timisoara
Romania

Phone: +40 256 201269, +40 356 101412
Mobile: +40 721 723604
E-mail: [hidden email]
http://www.savatech.ro


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: CMIS UCP extension

Kai Sommerfeld
In reply to this post by Dan Corneanu
Hi Dan,

On 19.05.10 13:52, Dan Corneanu wrote:

> On 5/19/2010 11:52 AM, Kai Sommerfeld wrote:
>> Hi Dan,
>>
>>   adding CMIS support to UCB would be a very valuable functional
>> enhancement for OOo. Do you plan to contribute your work back to the
>> OOo source repository?
>>
>> - Kai.
>>
> If I manage to write a java based UCP able to read/write a given
> document in CMIS then I surely contribute it as open source.

  Cool. We look forward seeing your code.

> Currently the cmis UCP registeres itself, gets called for "cmis:"
> schemas, knows how to talk with a CMIS repository and fetch object
> properties, but I have some hard times implementing the "open" command.

  If you could provide some more details we would have chances to help
you. ;-)

> Unfortunately all existing implementations are in C++.
>

  Have you considered C++ for your implementation? As you already found
out there is ucbhelper, which makes a ucp implementation much less painful.

- Kai.

>> On 19.05.10 09:58, Dan Corneanu wrote:
>>> Hi,
>>> I have managed to write a skeleton implementation of a UCP in java and
>>> registered it to handle the "cmis" schema. My URI looks like this
>>> "cmis:///foo/bar#http://a.serve.com/cmis" and as far as I know this is a
>>> valid hierarchical URI.
>>>
>>> If I try to open this URL by putting it in the "Load Url" command from
>>> the toolbar, my UCP createContentIdentifier() gets called with
>>> "cmis:///foo/bar".
>>>
>>> Why is the fragment part removed from the URI ?
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>>
>>
>
>


--
OpenOffice.org Engineering at Sun: http://blogs.sun.com/GullFOSS

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: CMIS UCP extension

stephan.bergmann
In reply to this post by Dan Corneanu
On 05/19/10 13:57, Dan Corneanu wrote:

> The URI was privately cooked for my implementation. Any suggestions for
> a proper URI schema are welcomed.
> I need a schema for a hierarchical URI that can specify the path to a
> given document on a CMIS repository along with the URL to the CMIS
> webservices deployed on the repository.
>
> Ex. cmis:///foo/bar#http://a.serve.com/cmis
> cmis - cmis URI schema identifier
> /foo/bar - the path to the document starting from the repository's root
> http://a.serve.com/cmis - the URI to the repository server

OOo's vnd.sun.star.pkg scheme has the same requirements and encodes the
repository URI in the authority component, a la

   cmis://http:%2F%2Fa.serve.com%2Fcmis/foo/bar

-Stephan

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: CMIS UCP extension

Dan Corneanu
On 5/19/2010 3:43 PM, Stephan Bergmann wrote:

> On 05/19/10 13:57, Dan Corneanu wrote:
>> The URI was privately cooked for my implementation. Any suggestions for
>> a proper URI schema are welcomed.
>> I need a schema for a hierarchical URI that can specify the path to a
>> given document on a CMIS repository along with the URL to the CMIS
>> webservices deployed on the repository.
>>
>> Ex. cmis:///foo/bar#http://a.serve.com/cmis
>> cmis - cmis URI schema identifier
>> /foo/bar - the path to the document starting from the repository's root
>> http://a.serve.com/cmis - the URI to the repository server
>
> OOo's vnd.sun.star.pkg scheme has the same requirements and encodes
> the repository URI in the authority component, a la
>
>   cmis://http:%2F%2Fa.serve.com%2Fcmis/foo/bar
>

cmis:http://a.serve.com/cmis/foo/bar

The problem with such a schema would be to decide how much of the URI
represents the webservices URL and how much the path inside the repository.

Ex. Am I looking for document /cmis/foo/bar and the CMIS webservices are
accessible through http://a.serve.com ?
or Am I looking for document /foo/bar and the CMMIS webservices are
accessible through http://a.serve.com/cmis ?

I have already had a look to vnd.sun.star.pkg and I think in this case
it is simple to answer these questions because you just have to
check each segment of the path to see if there exist a file with that
path on the disk. When you are not able to fine a file then it means the
rest of the path
is the path inside the archive. Am I right ?

> -Stephan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
>


--
Dan Corneanu
Sava Technologies SRL
Eroilor de la Tisa nr. 33
300553 Timisoara
Romania

Phone: +40 256 201269, +40 356 101412
Mobile: +40 721 723604
E-mail: [hidden email]
http://www.savatech.ro


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: CMIS UCP extension

stephan.bergmann
On 05/19/10 15:08, Dan Corneanu wrote:

> On 5/19/2010 3:43 PM, Stephan Bergmann wrote:
>> OOo's vnd.sun.star.pkg scheme has the same requirements and encodes
>> the repository URI in the authority component, a la
>>
>>   cmis://http:%2F%2Fa.serve.com%2Fcmis/foo/bar
>>
>
> cmis:http://a.serve.com/cmis/foo/bar
>
> The problem with such a schema would be to decide how much of the URI
> represents the webservices URL and how much the path inside the repository.
>
> Ex. Am I looking for document /cmis/foo/bar and the CMIS webservices are
> accessible through http://a.serve.com ?
> or Am I looking for document /foo/bar and the CMMIS webservices are
> accessible through http://a.serve.com/cmis ?
>
> I have already had a look to vnd.sun.star.pkg and I think in this case
> it is simple to answer these questions because you just have to
> check each segment of the path to see if there exist a file with that
> path on the disk. When you are not able to fine a file then it means the
> rest of the path
> is the path inside the archive. Am I right ?

No.  As I wrote, it "*encodes* the repository URI in the authority
component" (emphasis added).  Any characters that cannot directly appear
in the authority component (e.g., "/") are escaped (the "%2F" parts above).

-Stephan

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: CMIS UCP extension

Dan Corneanu

> No.  As I wrote, it "*encodes* the repository URI in the authority
> component" (emphasis added).  Any characters that cannot directly
> appear in the authority component (e.g., "/") are escaped (the "%2F"
> parts above).
>

Yes, you are right.

> -Stephan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
>


--
Dan Corneanu
Sava Technologies SRL
Eroilor de la Tisa nr. 33
300553 Timisoara
Romania

Phone: +40 256 201269, +40 356 101412
Mobile: +40 721 723604
E-mail: [hidden email]
http://www.savatech.ro


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: CMIS UCP extension

Dan Corneanu
In reply to this post by Kai Sommerfeld
On 5/19/2010 3:17 PM, Kai Sommerfeld wrote:
>> Currently the cmis UCP registeres itself, gets called for "cmis:"
>> schemas, knows how to talk with a CMIS repository and fetch object
>> properties, but I have some hard times implementing the "open" command.
>
>  If you could provide some more details we would have chances to help
> you. ;-)

One problem is related to returning an XInputStream from the "open"
command. I have used
InputStreamToXInputStreamAdapter but it seems to be trying to call the
underlying InputStream.read(byte[] b, int off, int len) with
 null for the first argument.

Is this a known issue? Do I have to come up with my own implementation
of an adapter ?
I have seen there are some discussions on the forum regarding the
adapter but I was not able to find any clear statement on the matter.

>
>> Unfortunately all existing implementations are in C++.
>>
>
>  Have you considered C++ for your implementation? As you already found
> out there is ucbhelper, which makes a ucp implementation much less
> painful.
>
> - Kai.
I have thought of this but my experience is mostly with Java.

--
Dan Corneanu
Sava Technologies SRL
Eroilor de la Tisa nr. 33
300553 Timisoara
Romania

Phone: +40 256 201269, +40 356 101412
Mobile: +40 721 723604
E-mail: [hidden email]
http://www.savatech.ro


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: CMIS UCP extension

Tobias Krause-2
Hi Dan,

On 05/19/10 16:02, Dan Corneanu wrote:
> One problem is related to returning an XInputStream from the "open"
> command. I have used
> InputStreamToXInputStreamAdapter but it seems to be trying to call the
> underlying InputStream.read(byte[] b, int off, int len) with
>  null for the first argument.

You should prepare your ucp to return XOutputStream or XActiveDataSink
from a "open" command.

Try something like this:

XActiveDataSink xActiveDataSink =
(XActiveDataSink)UnoRuntime.queryInterface(XActiveDataSink.class, dataSink);

if (xActiveDataSink != null) {
    byte[] document = readFile();
    ByteArrayToXInputStreamAdapter adapter = new
ByteArrayToXInputStreamAdapter(document);
    xActiveDataSink.setInputStream(adapter);
}

XOutputStream xOutputStream =
(XOutputStream)UnoRuntime.queryInterface(XOutputStream.class, dataSink);
if (xOutputStream != null) {
    byte[] bytes = readFile();
    try {
      xOutputStream.writeBytes(bytes);
      xOutputStream.flush();
    } catch (Exception ex) {
      ex.printStackTrace();
    }


-
Tobias

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: CMIS UCP extension

Dan Corneanu
It works this way,
but I thought I should avoid keeping the entire document content in memory.

On 5/19/2010 5:43 PM, Tobias Krause wrote:

> Hi Dan,
>
> On 05/19/10 16:02, Dan Corneanu wrote:
>> One problem is related to returning an XInputStream from the "open"
>> command. I have used InputStreamToXInputStreamAdapter but it seems to
>> be trying to call the
>> underlying InputStream.read(byte[] b, int off, int len) with
>>  null for the first argument.
>
> You should prepare your ucp to return XOutputStream or XActiveDataSink
> from a "open" command.
>
> Try something like this:
>
> XActiveDataSink xActiveDataSink =
> (XActiveDataSink)UnoRuntime.queryInterface(XActiveDataSink.class,
> dataSink);
>
> if (xActiveDataSink != null) {
>    byte[] document = readFile();
>    ByteArrayToXInputStreamAdapter adapter = new
> ByteArrayToXInputStreamAdapter(document);
>    xActiveDataSink.setInputStream(adapter);
> }
>
> XOutputStream xOutputStream =
> (XOutputStream)UnoRuntime.queryInterface(XOutputStream.class, dataSink);
> if (xOutputStream != null) {
>    byte[] bytes = readFile();
>    try {
>      xOutputStream.writeBytes(bytes);
>      xOutputStream.flush();
>    } catch (Exception ex) {
>      ex.printStackTrace();
>    }
>
>
> -
> Tobias
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
>


--
Dan Corneanu
Sava Technologies SRL
Eroilor de la Tisa nr. 33
300553 Timisoara
Romania

Phone: +40 256 201269, +40 356 101412
Mobile: +40 721 723604
E-mail: [hidden email]
http://www.savatech.ro


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]