Package org.apache.chemistry.opencmis.client.api

Examples of org.apache.chemistry.opencmis.client.api.SessionFactory


        }
        session.getBinding().close();
    }

    protected Session createSession() {
        SessionFactory sessionFactory = SessionFactoryImpl.newInstance();
        Map<String, String> parameter = new HashMap<String, String>();
        parameter.put(SessionParameter.ATOMPUB_URL, CMIS_ENDPOINT_TEST_SERVER);
        parameter.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());

        Repository repository = sessionFactory.getRepositories(parameter).get(0);
        return repository.createSession();
    }
View Full Code Here


   
    public void connect(Map<String, String> parameters) {
        System.out.println("Connecting to a repository ...");

        // Create a SessionFactory and set up the SessionParameter map
        SessionFactory sessionFactory = SessionFactoryImpl.newInstance();

        session = sessionFactory.createSession(parameters);

        LOG.debug("Got a connection to repository.");
    }
View Full Code Here

 
  private Session cmisClientSession = null;
 
  private Session getCmisClientSession(){
    // default factory implementation
    SessionFactory factory = SessionFactoryImpl.newInstance();
    Map<String, String> parameters = new HashMap<String, String>();

    // user credentials
    parameters.put(SessionParameter.USER, CMIS_USERNAME);
    parameters.put(SessionParameter.PASSWORD, CMIS_PASSWORD);

    // connection settings
    parameters.put(SessionParameter.ATOMPUB_URL, CMIS_ENDPOINT_TEST_SERVER);
    parameters.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());

    // create session
    return factory.getRepositories(parameters).get(0).createSession();
  }
View Full Code Here

   
  private Session cmisClientSession = null;
 
  private Session getCmisClientSession(){
    // default factory implementation
    SessionFactory factory = SessionFactoryImpl.newInstance();
    Map<String, String> parameters = new HashMap<String, String>();

    // user credentials
    parameters.put(SessionParameter.USER, CmisConfig.USERNAME_DEFAULT_VALUE);
    parameters.put(SessionParameter.PASSWORD, CmisConfig.PASSWORD_DEFAULT_VALUE);

    // connection settings
    String endpoint =
        CmisConfig.PROTOCOL_DEFAULT_VALUE + "://" +
        CmisConfig.SERVER_DEFAULT_VALUE + ":" +
        CmisConfig.PORT_DEFAULT_VALUE +
        CmisConfig.PATH_DEFAULT_VALUE;
   
    parameters.put(SessionParameter.ATOMPUB_URL, endpoint);
    parameters.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());

    // create session
    return factory.getRepositories(parameters).get(0).createSession();
  }
View Full Code Here

   
  private Session cmisClientSession = null;
 
  private Session getCmisClientSession(){
    // default factory implementation
    SessionFactory factory = SessionFactoryImpl.newInstance();
    Map<String, String> parameters = new HashMap<String, String>();

    // user credentials
    parameters.put(SessionParameter.USER, CmisConfig.USERNAME_DEFAULT_VALUE);
    parameters.put(SessionParameter.PASSWORD, CmisConfig.PASSWORD_DEFAULT_VALUE);

    // connection settings
    String endpoint =
        CmisConfig.PROTOCOL_DEFAULT_VALUE + "://" +
        CmisConfig.SERVER_DEFAULT_VALUE + ":" +
        CmisConfig.PORT_DEFAULT_VALUE +
        CmisConfig.PATH_DEFAULT_VALUE;
   
    parameters.put(SessionParameter.ATOMPUB_URL, endpoint);
    parameters.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());

    // create session
    return factory.getRepositories(parameters).get(0).createSession();
  }
View Full Code Here

    public static void main(String args[]) {
       
        System.out.println(Hello.class.getName() + " started");

        // Create a SessionFactory and set up the SessionParameter map
        SessionFactory sessionFactory = SessionFactoryImpl.newInstance();
        Map<String, String> parameter = new HashMap<String, String>();

        // connection settings - we're connecting to a public cmis repo,
        // using the AtomPUB binding
        parameter.put(SessionParameter.ATOMPUB_URL, " http://opencmis.cloudapp.net/inmemory/atom/");
        parameter.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());

        // find all the repositories at this URL - there should only be one.
        List<Repository> repositories = new ArrayList<Repository>();
        repositories = sessionFactory.getRepositories(parameter);
        for (Repository r : repositories) {
            System.out.println("Found repository: " + r.getName());
        }

        // create session with the first (and only) repository
        Repository repository = repositories.get(0);
        parameter.put(SessionParameter.REPOSITORY_ID, repository.getId());
        Session session = sessionFactory.createSession(parameter);

        System.out.println("Got a connection to repository: " + repository.getName() + ", with id: "
                + repository.getId());

        // Get everything in the root folder and print the names of the objects
View Full Code Here

    protected abstract void init();

    @Test
    public void createDefaultSession() {
        SessionFactory factory = this.fixture.getSessionFactory();

        Hashtable<String, String> parameter = new Hashtable<String, String>(this.fixture.getParamter());

        Session s = factory.createSession(parameter);
        Assert.assertNotNull(s);
    }
View Full Code Here

        this.fixture.init();
    }

    @Before
    public void setUp() {
        SessionFactory factory = this.fixture.getSessionFactory();
        this.session = factory.createSession(this.fixture.getParamter());
        this.fixture.setUpTestData(this.session);

        this.session2 = factory.createSession(this.fixture.getParamter());
    }
View Full Code Here

    public void init() {
        /* get optional path from system properties */
        Properties properties = null;
        Map<String, String> sessionParameter = null;
        SessionFactory factory = null;
        String factoryClassName = null;
        try {
            // get settings
            InputStream in = Fixture.class.getResourceAsStream(this.connectionPath);
            properties = new Properties();
View Full Code Here

    protected abstract void init();

    @Test
    public void createDefaultSession() {
        SessionFactory factory = this.fixture.getSessionFactory();

        Hashtable<String, String> parameter = new Hashtable<String, String>(this.fixture.getParamter());
        parameter.remove(SessionParameter.SESSION_TYPE);

        Session s = factory.createSession(parameter);
        Assert.assertNotNull(s);
    }
View Full Code Here

TOP

Related Classes of org.apache.chemistry.opencmis.client.api.SessionFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.