Search in sources :

Example 1 with SessionFactory

use of org.apache.chemistry.opencmis.client.api.SessionFactory in project camel by apache.

the class SessionFactoryLocator method loadSessionFactoryFromClassPath.

private static SessionFactory loadSessionFactoryFromClassPath() {
    try {
        Class<?> factoryClass = null;
        factoryClass = Class.forName("org.apache.chemistry.opencmis.client.runtime.SessionFactoryImpl");
        if (factoryClass != null) {
            Method method = factoryClass.getMethod("newInstance", new Class<?>[0]);
            return (SessionFactory) method.invoke(null, new Object[0]);
        }
    } catch (Exception ex) {
        LOG.error("Cannot create the SessionFactoryImpl due to: {0}", ex);
        throw new RuntimeCamelException(ex);
    }
    return null;
}
Also used : SessionFactory(org.apache.chemistry.opencmis.client.api.SessionFactory) RuntimeCamelException(org.apache.camel.RuntimeCamelException) Method(java.lang.reflect.Method) RuntimeCamelException(org.apache.camel.RuntimeCamelException)

Example 2 with SessionFactory

use of org.apache.chemistry.opencmis.client.api.SessionFactory in project camel by apache.

the class Activator method start.

@Override
public void start(BundleContext context) throws Exception {
    // get the reference of SessionFactory service
    reference = context.getServiceReference(SessionFactory.class.getName());
    SessionFactory sessionFactory = (SessionFactory) context.getService(reference);
    SessionFactoryLocator.setSessionFactory(sessionFactory);
}
Also used : SessionFactory(org.apache.chemistry.opencmis.client.api.SessionFactory)

Example 3 with SessionFactory

use of org.apache.chemistry.opencmis.client.api.SessionFactory in project camel by apache.

the class CMISTestSupport method createSession.

protected Session createSession() {
    SessionFactory sessionFactory = SessionFactoryImpl.newInstance();
    Map<String, String> parameter = new HashMap<String, String>();
    parameter.put(SessionParameter.ATOMPUB_URL, getUrl());
    parameter.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());
    Repository repository = sessionFactory.getRepositories(parameter).get(0);
    return repository.createSession();
}
Also used : SessionFactory(org.apache.chemistry.opencmis.client.api.SessionFactory) Repository(org.apache.chemistry.opencmis.client.api.Repository) HashMap(java.util.HashMap)

Aggregations

SessionFactory (org.apache.chemistry.opencmis.client.api.SessionFactory)3 Method (java.lang.reflect.Method)1 HashMap (java.util.HashMap)1 RuntimeCamelException (org.apache.camel.RuntimeCamelException)1 Repository (org.apache.chemistry.opencmis.client.api.Repository)1