bibryam / camel-cmis

CMIS connector for Apache Camel
6 stars 2 forks source link

Unauthorized error when used with Alfresco 5.0.d and 5.1.x #3

Open jpotts opened 8 years ago

jpotts commented 8 years ago

This component works against the Apache Chemistry In Memory CMIS repo, but if you try to use it against a real repository, such as Alfresco 5.0.d or 5.1.x, it fails to establish a CMIS session.

The problem appears to be in the CMISComponent class. The parameters are not being maintained. In a debugger, I can see that the username and password are null, despite being passed in successfully.

I'm still working through it, but I am curious as to why on line 36 the sessionFacade is instantiated twice--once before the endpoint instantiation and once inside the endpoint constructor. The first sessionFacade instantiation works, but the second one fails due to the null username/password.

    protected Endpoint createEndpoint(String uri, final String remaining, final Map<String, Object> parameters) throws Exception {
        boolean queryMode = removeQueryMode(parameters);

        CMISSessionFacade sessionFacade = new CMISSessionFacade(remaining);
        setProperties(sessionFacade, parameters);

        CMISEndpoint endpoint = new CMISEndpoint(uri, this, new CMISSessionFacadeFactory() {
            @Override
            public CMISSessionFacade create() throws Exception {
                CMISSessionFacade sessionFacade = new CMISSessionFacade(remaining);
                setProperties(sessionFacade, parameters);

                return sessionFacade;
            }
        });

        endpoint.setQueryMode(queryMode);

        return endpoint;
    }
bibryam commented 8 years ago

This component has been merged to Apache Camel long ago. And it is maintained and updated over there. Can you try that one out

https://github.com/bibryam/camel-cmis/blob/master/src/main/java/org/apache/camel/CMISComponent.java

Also, in the past I have used the component agains Alfresco demo server and it did work fine (at least connected and read some content).

HTH