Search code examples
javacmisapache-chemistry

Local binding to an OpenCMIS server using Apache Chemistry


first of all, I'd appreciate if anybody could add "apache-chemistry" tag, I have not enough mana for that.

I can't find any information on this local binding, it's the third way of connecting to an OpenCMIS server.

It's the case when one wants to have a shared access layer to a remote repository and a JCR repository running locally, for example. It's obvious how the remote setup works, but I don't understand what this mean:

parameter.put(SessionParameter.LOCAL_FACTORY, "my.local.factory");

EDITED: In the meantime I found it could be the repository connector, into which the data from CMIS clients are converted and pushed, but I'm not sure...

A repository connector has to extend the AbstractServiceFactory class


Solution

  • It's complicated to explain, I suppose that the best thing to do is checking out inMemoryServer from SVN. The documentation you referenced is an example of Client API, where the session interface contain the most important CMIS operations.

    SessionFactory factory = SessionFactoryImpl.newInstance();
    Map<String, String> parameter = new HashMap<String, String>();
    ..........
    parameter.put(SessionParameter.LOCAL_FACTORY, "my.local.factory");
    ..........
    Session session = factory.createSession(parameter);
    

    After you have the source, take a look at "InMemoryServiceFactoryImpl" which is the LOCAL_FACTORY parameter value. This factory has a service() method that returns InMemoryService, which holds references to all types of CMIS services and it servers as some sort of facade for simplified using via the Client API (Session way).

    Another way is using Client Binding API, where you access concrete CMIS services directly.

    CmisBindingFactory factory = CmisBindingFactory.newInstance();
    CmisBinding binding = factory.createCmisLocalBinding(parameters); // LocalBinding !!
    fFactory = binding.getObjectFactory();
    fRepSvc = binding.getRepositoryService();
    fObjSvc = binding.getObjectService();
    fNavSvc = binding.getNavigationService();
    fVerSvc = binding.getVersioningService();
    fMultiSvc = binding.getMultiFilingService();
    fDiscSvc = binding.getDiscoveryService();
    

    etc., etc., take a look at the tests, which practically cover most of the use cases.