I am using chemistry-opencmis-1.1.0.
My understanding is, we first create Session and from Session, we get the ServiceRegistry.
However, when I look at the org.apache.chemistry.opencmis.client.api.Session, I do not see any method called getServiceRegistry. Should I import a different package of Session, which will have the method called getServiceRegistry?
How should we get the serviceRegistry? (This application is not an android mobile app, just a regular Java class).
In my Java project classpath, I have:
chemistry-opencmis-client-api-1.1.0.jar
chemistry-opencmis-client-bindings-1.1.0.jar
chemistry-opencmis-client-impl-1.1.0.jar
chemistry-opencmis-commons-api-1.1.0.jar
chemistry-opencmis-commons-impl-1.1.0.jar
I have written code similar to the following:
//I have the following imports:
org.apache.chemistry.opencmis.commons.SessionParameter;
org.apache.chemistry.opencmis.commons.enums.BindingType;
org.apache.chemistry.opencmis.client.api.SessionFactory;
org.apache.chemistry.opencmis.client.runtime.SessionFactoryImpl;
org.apache.chemistry.opencmis.client.api.Session;
org.alfresco.service.ServiceRegistry;
Map<String, String> parameter = new HashMap<String, String>();
// user credentials
parameter.put(SessionParameter.USER, "admin");
parameter.put(SessionParameter.PASSWORD, "admin");
// connection settings
parameter.put(SessionParameter.ATOMPUB_URL, "http://localhost:8080/alfresco/api/-default-/cmis/versions/1.1/atom");
parameter.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());
System.out.println(BindingType.ATOMPUB.value());
// set the alfresco object factory
parameter.put(SessionParameter.OBJECT_FACTORY_CLASS, "org.alfresco.cmis.client.impl.AlfrescoObjectFactoryImpl");
// create session
SessionFactory factory = SessionFactoryImpl.newInstance();
Session session = factory.getRepositories(parameter).get(0).createSession();
//I get error in the line below with error message - cannot find the method getServiceRegistry from Session.
ServiceRegistry serviceRegistryFromSession = session.getServiceRegistry();