chemistry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Florian Müller <florian.muel...@alfresco.com>
Subject Re: OpenCMIS Client Questions
Date Thu, 16 Sep 2010 09:27:48 GMT
Hi Chris,

CMIS is not about the binding, it is about the domain model, that, at some point, has to be
mapped to a wire protocol.
One of the goals of OpenCMIS is to hide the binding. It should not be necessary for an application
developer to know in advance which binding will be used eventually by the application user.
So, no, there will be no binding specific methods in the client API.

There are also CMIS repositories that only support the Web Services binding. You could argue
that those are not spec compliant, but if you rely on AtomPub specific details you can't connect
to them.

The CMIS Technical Committee is currently working on a third, JSON based binding for CMIS
1.1. If you tie yourself to the AtomPub binding you will not be able to use this new binding
in the future. OpenCMIS users that solely rely on the OpenCMIS API will just have to move
to the newest jars and can use this new binding right away without changing their code.


Nonetheless, here is the code snippet that gets you the AtomPub content link:


public static final String getDocumentURL(final Document document, final Session session)
{
    String link = null;

    try {
        Method loadLink = AbstractAtomPubService.class.getDeclaredMethod("loadLink", new Class[]
{ String.class, String.class, String.class, String.class });
        loadLink.setAccessible(true);
        link = (String) loadLink.invoke(session.getBinding().getObjectService(), session.getRepositoryInfo().getId(),
document.getId(), AtomPubParser.LINK_REL_CONTENT, null);
    } catch (Exception e) {
         e.printStackTrace();
    }

    return link;
}


Cheers,

Florian


----- Original Message -----
From: "Chris Hubick" <chris@hubick.com>
To: chemistry-dev@incubator.apache.org
Sent: Thursday, September 16, 2010 2:05:09 AM GMT +00:00 GMT Britain, Ireland, Portugal
Subject: Re: OpenCMIS Client Questions

On Wed, 2010-09-15 at 10:22 +0100, Florian Müller wrote:
> I hope I have some answers for you.

Thanks!  That seems to fix most my problems :)

> We still use the tools that were available when we started OpenCMIS 
> (Maven 2 and jaxws-rt 2.1.7). Since we didn't run into any problem with 
> that we had never changed it. Also Maven 3 doesn't seem to be widely 
> used yet. We may should start a discussion moving to jaxws-rt 2.2 but I 
> don't think will adopt Maven 3 anytime soon.

It's worth noting that the current Eclipse Maven plugin already uses
version 3 internally, and that even if you don't adopt Maven 3 for
*building* OpenCMIS yourself, this will prevent anyone easily *using*
OpenCMIS within their Maven 3 environment/projects.  And not only is it
a problem for me as a user of OpenCMIS, but then my software won't
automatically build for my users either :(  Your call though.


> There is no (official) way to get a URL that returns the document 
> content for a simple reason: It doesn't work with the Web Services 
> binding. With the Web Services binding there is always a Web Services 
> wrapper around the content. There is no plain content URL by definition 
> and it might not even be transported via HTTP.
> 
> If you are only using the AtomPub binding there are two ways to achieve 
> what you want.
> 1) You can get the content URL from OpenCMIS' internal binding cache. 
> It's not supported, it's not a public API and it might change in the 
> future. If you still want to do that, please contact me and I will send 
> you a code snippet that gets you the URL.

I take it this implies you don't care to create a supported public API
for AtomPub users? :(

I tried to sniff around and see if I could figure out (1) myself.
Looking at how the atompub.ObjectServiceImpl.getContentStream()
retrieves content, that made me want to try something like:

public static final String getDocumentURL(final Document document, final Session session)
{
  return ((ObjectServiceImpl)session.getBinding().getObjectService()).loadLink(session.getRepositoryInfo().getId(),
document.getId(), AtomPubParser.LINK_REL_CONTENT, null);
}

Except that won't work because AbstractAtomPubService.loadLink() is
protected.  I couldn't find any way to get access to the LinkCache or
spi.Session either.

So, please, help enlighten me?

Again, Much Thanks! :)

-- 
Chris Hubick
mailto:chris@hubick.com
http://www.hubick.com/chris/


Mime
View raw message