cancel
Showing results for 
Search instead for 
Did you mean: 

CMIS API and interoperability

puntino
Champ in-the-making
Champ in-the-making
Hello,
I have a big doubt on CMIS and the software developed for its implementation. Probably, I do not understand
because I'm still a freshman in the ECM world.
To make  my point clear, I'm going to provide to you an example.
Hypothesis: I'm using the alfresco chemistry API  (org.alfresco.chemistry)
For sake of simplicity suppose I want to write a method for connecting to Alfresco:
I'd write something like:

import org.apache.chemistry.tck.atompub.http.httpclient.HttpClientConnectionFactory;
public connectoToEcm(String username, String passwpord){
  ConnectionFactory connFactory = new HttpClientConnectionFactory();
  Connection connection = connFactory.createConnection(username, password);
}

if I decide to replace Alfresco with FileNet, can I still use the method connectToEcm?
should I change the ConnectionFactory object?
Thank you
8 REPLIES 8

unknown-user
Champ on-the-rise
Champ on-the-rise
Ive been playing with this to see if we should go with this instead of FileNet. Actually we are looking to move away from FileNet.
I know some of the Alfresco US sales team. We were very close to going with Alfresco but politics slowed down this plan.
It could still happen but I see it happening 2 years from now. But since this community is dead here, I cant get a head start.
The problem is that the support community is dead. here.
Either that or everyone is still learning and cant help each other.
I think Alfresco group needs a community service reward program.
Microsoft calls you a MVP. They need a group like this to encourage supporting each other.
Most of the problems are either configuration problems or bugs in the code. I suspect primarily configuration problems due to our naivity.
Im doing .NET but maybe this code from their example may point you in the right direction:







import org.alfresco.repo.cmis.ws.CmisRepositoryCapabilitiesType;
import org.alfresco.repo.cmis.ws.CmisRepositoryEntryType;
import org.alfresco.repo.cmis.ws.CmisRepositoryInfoType;
import org.alfresco.repo.cmis.ws.CmisTypeContainer;
import org.alfresco.repo.cmis.ws.CmisTypeDefinitionType;
import org.alfresco.repo.cmis.ws.CmisTypePolicyDefinitionType;
import org.alfresco.repo.cmis.ws.CmisTypeRelationshipDefinitionType;
import org.alfresco.repo.cmis.ws.EnumServiceException;
import org.alfresco.repo.cmis.ws.GetRepositories;
import org.alfresco.repo.cmis.ws.GetRepositoryInfo;
import org.alfresco.repo.cmis.ws.GetRepositoryInfoResponse;
import org.alfresco.repo.cmis.ws.GetTypeChildren;
import org.alfresco.repo.cmis.ws.GetTypeChildrenResponse;
import org.alfresco.repo.cmis.ws.GetTypeDefinition;
import org.alfresco.repo.cmis.ws.GetTypeDescendants;
import org.alfresco.repo.cmis.ws.RepositoryServicePortBindingStub;


RepositoryServicePortBindingStub repositoryService = getServicesFactory().getRepositoryService(getProxyUrl() + getService().getPath());
        CmisRepositoryEntryType[] repositories = repositoryService.getRepositories(new GetRepositories());
        String repositoryId = repositories[0].getRepositoryId();
        GetRepositoryInfo getRepositoryInfo = new GetRepositoryInfo(repositoryId, null);
        repositoryService.getRepositoryInfo(getRepositoryInfo);
        String typeId = repositoryService.getTypeDescendants(new GetTypeDescendants(repositoryId, null, BigInteger.valueOf(-1), true, null))[0].getType().getId();
        repositoryService.getTypeChildren(new GetTypeChildren(repositoryId, typeId, true, BigInteger.ZERO, BigInteger.ZERO, null)).getTypes().getTypes()[0].getId();
        repositoryService.getTypeDefinition(new GetTypeDefinition(repositoryId, typeId, null));

dennisnk
Champ in-the-making
Champ in-the-making
When you say CMIS, do you refer to CMIS in general or Alfresco's implementation of CMIS? As I understand CMIS only specifies the format and procedure for exchanging data between CM systems. How to connect to a specific repository is out of scope concerning CMIS.

I'm using .NET, but by your example code I'd say you'll need to either replace the connectToEcm method with one that connects to FileNet (instead of Alfresco) or update the ConnectionFactory to return a FileNet connection. In .NET this would be done using a variant of the Abstract Factory Pattern, I would expect similar solutions to be used in Java.

I'm new to CMIS, so I may have misunderstood your question, if not the above design pattern should solve the problem.

unknown-user
Champ on-the-rise
Champ on-the-rise
Currently, Im getting an error saying the timestamp has expired.
Has anyone successfully used connected to Alfresco using Alfresco's CMIS wsdl?


System.ServiceModel.FaultException was caught
  Message="The message has expired (WSSecurityEngine: Invalid timestamp The security semantics of message have expired)"
  Source="mscorlib"
 
If anyone has any ideas let me know. My header is the following:
<Security s:mustUnderstand="1" xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
      <wsu:Timestamp wsu:Id="Timestamp-718019295720" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
        <wsu:Created>2009-11-14T19:56:41.929Z</wsu:Created>
        <wsu:Expires>2009-11-14T20:01:41.929Z</wsu:Expires>
      </wsu:Timestamp>
      <UsernameToken wsu:Id="UsernameToken-718019295720" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
        <Username>admin</Username>
        <Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">admin</Password>
        <Nonce>IGRKG/ABNywDNZ1/lxxarA==</Nonce>
        <wsu:Created>2009-11-14T19:56:41.929Z</wsu:Created>
      </UsernameToken>
</Security>
  </s:Header>

dennisnk
Champ in-the-making
Champ in-the-making
The timestamp error might be due to the client clock not being in sync with the server clock.

See thread http://forums.alfresco.com/en/viewtopic.php?p=33522.

Hope that helps.

unknown-user
Champ on-the-rise
Champ on-the-rise
Yes I saw that but I am running the client and server on the same machine.

puntino
Champ in-the-making
Champ in-the-making
Thanks all you.
What I was trying to say if it's available a common API that we can use for every CM systems. Maybe I didn't manage to spell out my doubt, formerly.
Moreover when I posted my question I barely knew CMIS.  Now that I've gained more information about  CMIS, I agree with Dennish.
CMIS standardizes the way/ the procedures used to operate with a CM system, it does not point out  a specific CMIS implementation.
I was wondering if it exists a CMIS implementation in Java that I can use for every content manager CMIS compliant.  After some researches I thought
that a better approach is to move towards the Atom-REST APIs that, I suppose, they would cooperate with different CM systems.
To sort out this problem, as Dennish said you might adopt an Abstract Factory model. It's an excellent solution, of course, that I've been implementing over and over.
The point is that I do not want  to write different connectors (one for each CM system) and  switch from one to another using Abstract factory
or other design patterns. I hoped that the solution was in the Atom-REST APIs.  With this API you should be able to use every CM systems regardless the specific one. I'm going to try them and report here if I was successful in my attempt.  
@kwells7101  you are right, but this is the common problem related to "open-source" communities.  I do not think it's a good idea to voice our grievance here,
hopefully in the future we'll be better supported.
HAND

dennisnk
Champ in-the-making
Champ in-the-making
@puntino I might have misunderstood your initial question. Are you implementing a CMIS client or a CMIS service?

If you're implementing a service I don't see how one would change the underlying repository without having to change the connection class or method.

If you're implementing a client you shouldn't need to change the connection class or method in order to change the remote repository to communicate with. If you're using the REST/Atom binding all you need to specify is the service URI and, if necessary, credentials.

Please do get back on how you're progressing. I'm doing a CMIS implementation in .NET and am interested to which issues arise in Java.

puntino
Champ in-the-making
Champ in-the-making
Dear  dennisnk,
thank you again for your answer. As you said if we want to implement a CMIS service we're tighted to the underlying CM systems.
You do not need to excuse yourself,  I haven't explicitly told what I was doing !
I want to write a simple CMIS client and for the former reasons I'm moving towards REST Atom implementation.
I suppose you are developing a CMIS service, aren't you ?
Anyway I want to share my experience with you and the others.
keep in touch.