开发者

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 t开发者_StackOverflowhe 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


It is supposed to be the

Class name of the local service factory if client and server reside in the same JVM

See Creating a Local binding instance here and description for LOCAL_FACTORY here


You have to have an OpenCMIS server implementation to use the local binding. If there is one, pass the class name of the service factory and the client will use it. It will call the services (Java interfaces) directly without sending data over the network. There is nothing else to do on the client side.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜