public Session createCmisSession(String username, String password){ cmisSessionInitProperties.put(SessionParameter.USER, username); cmisSessionInitProperties.put(SessionParameter.PASSWORD, password); return sessionFactory.createSession(cmisSessionInitProperties); }
public Session createCmisSession(String repositoryId, String username, String password){ cmisSessionInitProperties.put(SessionParameter.REPOSITORY_ID, repositoryId); cmisSessionInitProperties.put(SessionParameter.USER, username); cmisSessionInitProperties.put(SessionParameter.PASSWORD, password); return sessionFactory.createSession(cmisSessionInitProperties); }
public Session createCmisSession() throws Exception { if (cmisSessionInitProperties.get(SessionParameter.USER) == null || cmisSessionInitProperties.get(SessionParameter.USER) == null) { throw new Exception("CmisSessionFactoryBean: not default user or password specified and no credentials have been explicitly specified"); } return sessionFactory.createSession(cmisSessionInitProperties); }
private Session createSession() { try { SessionFactory factory = SessionFactoryImpl.newInstance(); // create session session = factory.createSession(parameters); } catch (Exception e) { session = null; } return session; }
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."); }
private Session createCmisSession() { SessionFactory cmisSessionFactory = SessionFactoryImpl.newInstance(); Map<String, String> parameter = new HashMap<String, String>(); // user credentials parameter.put(SessionParameter.USER, repositoryUser); parameter.put(SessionParameter.PASSWORD, repositoryPassword); // connection settings parameter.put(SessionParameter.ATOMPUB_URL, repositoryAtomUrl); parameter.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value()); parameter.put(SessionParameter.REPOSITORY_ID, repositoryId); return cmisSessionFactory.createSession(parameter); }
/** * Creates new session to CMIS based on given connection details using ATOM binding * @param user * @param password * @param url * @param repository * @return */ protected Session getRepositorySession(String user, String password, String url, String repository) { SessionFactory factory = SessionFactoryImpl.newInstance(); Map<String, String> parameter = new HashMap<String, String>(); // user credentials parameter.put(SessionParameter.USER, user); parameter.put(SessionParameter.PASSWORD, password); // connection settings parameter.put(SessionParameter.ATOMPUB_URL, url); parameter.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value()); parameter.put(SessionParameter.REPOSITORY_ID, repository); // create session Session session = factory.createSession(parameter); return session; }
protected Session getCmisSession() { if (cachedSession == null) { synchronized (this) { if (cachedSession == null) { Map<String, String> parameters = new HashMap<String, String>(); parameters.put(SessionParameter.USER, cmisUser); parameters.put(SessionParameter.PASSWORD, cmisPassword); parameters.put(SessionParameter.ATOMPUB_URL, cmisAtompubUrl); parameters.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value()); // We're using the Alfresco extensions parameters.put(SessionParameter.OBJECT_FACTORY_CLASS, "org.alfresco.cmis.client.impl.AlfrescoObjectFactoryImpl"); // First need to fetch the repository info to know the repo id SessionFactory sessionFactory = SessionFactoryImpl.newInstance(); List<Repository> repositories = sessionFactory.getRepositories(parameters); String repositoryId = repositories.get(0).getId(); parameters.put(SessionParameter.REPOSITORY_ID, repositoryId); cachedSession = sessionFactory.createSession(parameters); } } } return cachedSession; }
public static void testDirectChemistryConnect() { // default factory implementation SessionFactory factory = SessionFactoryImpl.newInstance(); Map<String, String> parameter = new HashMap<String, String>(); // connection settings parameter.put(SessionParameter.BINDING_TYPE, BindingType.WEBSERVICES.value()); parameter.put(SessionParameter.WEBSERVICES_ACL_SERVICE, CMIS_URL + "services/ACLService?wsdl"); parameter.put(SessionParameter.WEBSERVICES_DISCOVERY_SERVICE, CMIS_URL + "services/DiscoveryService?wsdl"); parameter.put(SessionParameter.WEBSERVICES_MULTIFILING_SERVICE, CMIS_URL + "services/MultiFilingService?wsdl"); parameter.put(SessionParameter.WEBSERVICES_NAVIGATION_SERVICE, CMIS_URL + "services/NavigationService?wsdl"); parameter.put(SessionParameter.WEBSERVICES_OBJECT_SERVICE, CMIS_URL + "services/ObjectService10?wsdl"); parameter.put(SessionParameter.WEBSERVICES_POLICY_SERVICE, CMIS_URL + "services/PolicyService?wsdl"); parameter.put(SessionParameter.WEBSERVICES_RELATIONSHIP_SERVICE, CMIS_URL + "services/RelationshipService?wsdl"); parameter.put(SessionParameter.WEBSERVICES_REPOSITORY_SERVICE, CMIS_URL + "services/RepositoryService10?wsdl"); parameter.put(SessionParameter.WEBSERVICES_VERSIONING_SERVICE, CMIS_URL + "services/VersioningService?wsdl"); // Default repository id for in memory server is A1 parameter.put(SessionParameter.REPOSITORY_ID, "A1"); // create session final Session session = factory.createSession(parameter); assertTrue("Chemistry session should exists.", session != null); }
@Override public void run() throws Exception { Session session; SessionParameterMap parameters = new SessionParameterMap(getParameters()); if (!parameters.containsKey(SessionParameter.USER_AGENT)) { parameters.setUserAgent(TCK_USER_AGENT); } String repId = parameters.get(SessionParameter.REPOSITORY_ID); if (repId != null && repId.length() > 0) { session = factory.createSession(parameters); } else { session = factory.getRepositories(parameters).get(0).createSession(); } // switch off the cache session.getDefaultContext().setCacheEnabled(false); try { run(session); } catch (Exception e) { if (!(e instanceof FatalTestException)) { addResult(createResult(UNEXPECTED_EXCEPTION, "Exception: " + e, e, true)); } } catch (Error err) { addResult(createResult(UNEXPECTED_EXCEPTION, "Error: " + err, err, true)); } finally { testFolder = null; } }