Issue Details (XML | Word | Printable)

Key: CMIS-168
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Al Brown
Reporter: David Nuescheler
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
OASIS Content Management Interoperability Services (CMIS) TC

URL to id mapping

Created: 03/May/09 05:51 AM   Updated: 11/Jan/10 07:44 PM
Component/s: REST/AtomPub Binding
Affects Version/s: Draft 0.61
Fix Version/s: Draft 0.62

Proposal:
Add uritemplate to workspace element as defined below:

<xs:simpleType name="enumUriTemplateType">
<xs:restriction base="xs:string">
<xs:enumeration value="entrybyid" />
<xs:enumeration value="folderbypath" />
<xs:enumeration value="query" />
<xs:enumeration value="other" />
</xs:restriction>
</xs:simpleType>

<xs:complexType name="cmisUriTemplateType">
<xs:sequence>
<xs:element name="template" type="xs:string" />
<xs:element name="type" type="cmisra:enumUriTemplateType" />
<xs:element name="format" type="xs:string" />
<!-- extension -->
<xs:any processContents="lax" namespace="##other" minOccurs="0"
maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
<xs:element name="uritemplate" type="cmisra:cmisUriTemplateType" />

Example:
<uritemplate>
<template>http://www.example.com/id/{rep}/{objectid}</template>
<type>entrybyid</type>
<format>application/atom+xml;type=entry</format>
</uritemplate>

Define in the rest binding each type of uri template provided by ecm. include the variables for each template. If uri templates are not included in the workspace element then uri templates are not available by the implementation.

This does not impact the ws binding.


 Description  « Hide
reported in various discussions during the PlugFest in Basel, my interpretation may be off.

Currently there is no way to map document and folder ids to urls on the client side.
This will either lead to a large number of additional roundtrips or to very stateful clients
that rely on the stability of that mapping (which i am not sure if this would be legal).

So it would be great if there was a simple mapping from id's to URLs for both folders and
documents.

 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Jens Hübel added a comment - 06/May/09 03:26 AM
One of the use cases discussed in this area:
An application uses Atom binding to a CMIS repository. It uses CMIS to attach documents and content to its internal business objects. Using Atom everything is based on URLs. There is no generic way to get the id. The application should not store the URI as it contains volatile information like host names, some parameters or even a token. The preferred way would be a standardized way to get the id from the Atom URI, just store the id in the business object attachment and later at retrieval time have a method to convert the id back to a URI pointing the Atom entry.

A second notable area of use. For a generic CMIS client implementing both (SOAP and Atom) bindings it would be much easier to encapsulate the binding specific logic from the common parts if it just needs to deal with ids.

Julian Reschke added a comment - 06/May/09 03:54 AM
The atom format already supplies an immutable identifier, atom:id. This *can* be an HTTP URL. Alternatively, CMIS could define a method to map the atom:id to a URL.

Related: Cool URIs Do Not Change (<http://www.w3.org/Provider/Style/URI&gt;). So servers that expose known-to-be-unstable URLs are doing the wrong thing in the first place.

Al Brown added a comment - 08/May/09 05:45 PM
The options I see are:

1. add uri bases in cmis-specific schema. e.g., <getobject mimetype='application/atom+xml'>http://foo/atomentry&lt;/getobject>
2. leverage uri templates http://bitworking.org/projects/URI-Templates/spec/draft-gregorio-uritemplate-03.txt
3. leverage wadl https://wadl.dev.java.net/#spec

#1 is the least standard but probably the easiest/simplist.
#2 does not have an xsd format so we would have to create one
#3 seems like overkill

Al Brown added a comment - 04/Jun/09 05:54 PM
added proposal

Florian Müller added a comment - 05/Jun/09 05:06 AM
With URI templates and collections in the workspace element we would have two concepts addressing a similar idea. Shouldn't we focus on one?

Al Brown added a comment - 05/Jun/09 01:17 PM
How do you propose collections address this? I see two ways - a) define new cmis collection types that take uri arguments as input b) overload an existing collection with different uri arguments that if provided the collection returns a different object on get.

a) this method may introduce collections that do not act as atompub collections. we could turn off post by specifying an empty app:accept. Would we be limited to returning feeds instead of other formats such as atom entry since collections usually return a feed on get?

b) we could get probably get away with this, but the behavior of a selected collection would vary between a get without arguments and a get with uri arguments (could be an atom entry for example). These collections would be overloaded which leads to complexity.

Based on what I thought of, a new extension to atompub in the workspace was more straightforward.

Which of the above (or something else) are you proposing for 168, 169, 170? I'd be happy for collections to provide this functionality and close those issues.

Florian Müller added a comment - 08/Jun/09 06:03 AM
b) seems to be the worst solution.

If I'm looking at it from a lazy client developer perspective I already have code that deals with collections. The types and changes collections are also collections that don't accept POST. The main difference would be that this new collection would return a feed with only one entry.

I understand that the template mechanism is the cleaner approach, though. If we would introduce it here would it make sense to replace the GET-only collections as well with templates? I can imagine passing a type id the same way.

Additionally, if we add folderbypath here we would need an equivalent in the SOAP binding.

Al Brown added a comment - 08/Jun/09 02:24 PM
BTW,

James Snell is proposing an atom i-d to incorporate uri templates. I suggested to him that we would like to use it in the workspace element in the service document. He originally proposed it as a link template in feeds. Only the types and changes collection springs to mind as GET only. Query - post for new queries; Unfiled - POST to unfile from all folders; folder - POST to create, Checkedout - POST to check out a doc.

If we want to move away from REST'ish a bit, we could leverage GET in non-idempotent situations for checkout and unfile with uri templates. It's a question of how pure-ish we want to be wrt REST.

uri template - http://tools.ietf.org/html/draft-gregorio-uritemplate-02
link template - http://www.imc.org/atom-syntax/mail-archive/msg20170.html

Agreed on folderbypath.

Al Brown added a comment - 15/Jun/09 01:16 PM
accepted

Al Brown added a comment - 19/Jun/09 05:37 PM
Added to 62b and example service doc - excerpt:
        <cmisra:uritemplate>
            <cmisra:template>http://cmisexample.oasis-open.org/rep1/entrybyid/{id}</cmisra:template>
            <cmisra:type>entrybyid</cmisra:type>
            <cmisra:mediatype>application/atom+xml;type=entry</cmisra:mediatype>
        </cmisra:uritemplate>
        <cmisra:uritemplate>
            <cmisra:template>http://cmisexample.oasis-open.org/rep1/folderbypath/{path}</cmisra:template>
            <cmisra:type>folderbypath</cmisra:type>
            <cmisra:mediatype>application/atom+xml;type=entry</cmisra:mediatype>
        </cmisra:uritemplate>
        <cmisra:uritemplate>
            <cmisra:template>http://cmisexample.oasis-open.org/rep1/query?q={path}&amp;searchAllVersions={searchAllVersions}&amp;maxItems={maxItems}&amp;skipCount={skipCount}</cmisra:template>
            <cmisra:type>query</cmisra:type>
            <cmisra:mediatype>application/atom+xml;type=entry</cmisra:mediatype>
        </cmisra:uritemplate>

Al Brown added a comment - 04/Jan/10 11:54 PM
JIRA Cleanup