}catch(IOException e){
e.printStackTrace();
}
// Create a SessionFactory and set up the SessionParameter map
SessionFactory sessionFactory = SessionFactoryImpl.newInstance();
Map<String, String> parameter = new HashMap<String, String>();
// user credentials -
parameter.put(SessionParameter.USER, userEmail);
parameter.put(SessionParameter.PASSWORD, password);
// connection settings - substitute your own URL
parameter.put(SessionParameter.ATOMPUB_URL, dotCMSCMISURL);
parameter.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());
System.out.println("Accessing ATOMPUB_URL: " + parameter.get(SessionParameter.ATOMPUB_URL)
+ " userid: " + parameter.get(SessionParameter.USER)
+ " password: " + parameter.get(SessionParameter.PASSWORD) + EOL);
// 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() + EOL);