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

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


        Assert.assertNotNull(s);
    }

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

        Hashtable<String, String> parameter = new Hashtable<String, String>(this.fixture.getParamter());
        parameter.put(SessionParameter.SESSION_TYPE, SessionType.PERSISTENT.value());

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


        Assert.assertNotNull(s);
    }

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

        Hashtable<String, String> parameter = new Hashtable<String, String>(this.fixture.getParamter());
        parameter.put(SessionParameter.SESSION_TYPE, SessionType.TRANSIENT.value());

        try {
            @SuppressWarnings("unused")
            Session s = factory.createSession(parameter);
            Assert.fail("CmisNotSupportedException expected, because Transient Session is not supported yet.");
        } catch (CmisNotSupportedException e) {

        }
    }
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());

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

        this.fixture.init();
    }

    @Before
    public void setUp() throws Exception {
        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

   
  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

        // register the MetaTypeService now, that we are ready
        Dictionary<String, String> props = new Hashtable<String, String>();
        props.put(Constants.SERVICE_DESCRIPTION, "Apache Chemistry OpenCMIS Client Session Factory");
        props.put(Constants.SERVICE_VENDOR, "Apache Software Foundation");

        SessionFactory sessionFactory = SessionFactoryImpl.newInstance();
        context.registerService(SessionFactory.class.getName(), sessionFactory, props);
    }
View Full Code Here

        System.out.println("Getting Started...");
        System.out.println("------------------");

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

        // user credentials - using the standard admin/admin

        parameter.put(SessionParameter.USER, "admin");
        parameter.put(SessionParameter.PASSWORD, "admin");

        // connection settings - we're connecting to a public cmis repo,
        // using the AtomPUB binding, but there are other options here,
        // or you can substitute your own URL
        parameter.put(SessionParameter.ATOMPUB_URL,
         "http://opencmis.cloudapp.net/inmemory/atom/");
        // "http://cmis.alfresco.com/service/cmis");
//                "http://localhost:8080/alfresco/service/api/cmis");
        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());

        // // An example of creating a session with a known repository id.
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

        this.fixture.init();
    }

    @Before
    public void setUp() throws Exception {
        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

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.