org.apache.chemistry.opencmis.commons.enums.BindingType Java Examples
The following examples show how to use
org.apache.chemistry.opencmis.commons.enums.BindingType.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: OpenCmisLocalTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
private Repository getRepository(String user, String password) { // default factory implementation SessionFactory sessionFactory = SessionFactoryImpl.newInstance(); Map<String, String> parameters = new HashMap<String, String>(); // user credentials parameters.put(SessionParameter.USER, "admin"); parameters.put(SessionParameter.PASSWORD, "admin"); // connection settings parameters.put(SessionParameter.BINDING_TYPE, BindingType.LOCAL.value()); parameters.put(SessionParameter.LOCAL_FACTORY, "org.alfresco.opencmis.OpenCmisLocalTest$TestCmisServiceFactory"); // create session List<Repository> repositories = sessionFactory.getRepositories(parameters); return repositories.size() > 0 ? repositories.get(0) : null; }
Example #2
Source File: OpenCMISClientContext.java From alfresco-remote-api with GNU Lesser General Public License v3.0 | 6 votes |
public OpenCMISClientContext(BindingType bindingType, String url, String username, String password, Map<String, String> parameters, ApplicationContext ctx) throws IOException { cmisParameters = new HashMap<String, String>(); cmisParameters.putAll(parameters); cmisParameters.put(SessionParameter.BINDING_TYPE, bindingType.value()); if(bindingType.equals(BindingType.ATOMPUB)) { cmisParameters.put(SessionParameter.ATOMPUB_URL, url); } else if(bindingType.equals(BindingType.BROWSER)) { cmisParameters.put(SessionParameter.BROWSER_URL, url); } cmisParameters.put(SessionParameter.USER, username); cmisParameters.put(SessionParameter.PASSWORD, password); if (ctx != null) { Properties properties = (Properties)ctx.getBean("global-properties"); cmisParameters.put(SessionParameter.CONNECT_TIMEOUT, properties.getProperty("opencmis.tck.connecttimeout")); cmisParameters.put(SessionParameter.READ_TIMEOUT, properties.getProperty("opencmis.tck.readtimeout")); } createCMISParametersFile(); }
Example #3
Source File: TestPublicApiAtomPub10TCK.java From alfresco-remote-api with GNU Lesser General Public License v3.0 | 6 votes |
@Before public void before() throws Exception { // see REPO-1524 // the tests are always run on PostgreSQL only // Dialect dialect = (Dialect) applicationContext.getBean("dialect"); // assumeFalse(dialect instanceof Oracle9Dialect); int port = getTestFixture().getJettyComponent().getPort(); TestNetwork network = getTestFixture().getRandomNetwork(); Map<String, String> cmisParameters = new HashMap<String, String>(); cmisParameters.put(TestParameters.DEFAULT_RELATIONSHIP_TYPE, "R:cm:replaces"); clientContext = new OpenCMISClientContext(BindingType.ATOMPUB, MessageFormat.format(CMIS_URL, "localhost", String.valueOf(port), "alfresco", network.getId(), "public"), "admin@" + network.getId(), "admin", cmisParameters, getTestFixture().getJettyComponent().getApplicationContext()); overrideVersionableAspectProperties(getTestFixture().getJettyComponent().getApplicationContext()); }
Example #4
Source File: PublicApiClient.java From alfresco-remote-api with GNU Lesser General Public License v3.0 | 6 votes |
/** * Create a CMIS session using Enterprise AtomPub binding. * * @param repositoryId String * @param username String * @param password String * @return CmisSession */ public CmisSession createCMISSession(String repositoryId, String username, String password) { // default factory implementation SessionFactory factory = SessionFactoryImpl.newInstance(); Map<String, String> parameters = new HashMap<String, String>(); // user credentials parameters.put(SessionParameter.USER, username); parameters.put(SessionParameter.PASSWORD, password); // connection settings parameters.put(SessionParameter.ATOMPUB_URL, client.getCmisUrl(repositoryId, null)); parameters.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value()); if(repositoryId != null) { parameters.put(SessionParameter.REPOSITORY_ID, repositoryId); } parameters.put(SessionParameter.OBJECT_FACTORY_CLASS, AlfrescoObjectFactoryImpl.class.getName()); // create session Session session = factory.createSession(parameters); CmisSession cmisSession = new CmisSession(session); return cmisSession; }
Example #5
Source File: TestPublicApiAtomPub11TCK.java From alfresco-remote-api with GNU Lesser General Public License v3.0 | 6 votes |
@Before public void before() throws Exception { // see REPO-1524 // the tests are always run on PostgreSQL only // Dialect dialect = (Dialect) applicationContext.getBean("dialect"); // assumeFalse(dialect instanceof Oracle9Dialect); int port = getTestFixture().getJettyComponent().getPort(); TestNetwork network = getTestFixture().getRandomNetwork(); Map<String, String> cmisParameters = new HashMap<String, String>(); cmisParameters.put(TestParameters.DEFAULT_RELATIONSHIP_TYPE, "R:cm:replaces"); cmisParameters.put(TestParameters.DEFAULT_SECONDARY_TYPE, "P:cm:author"); cmisParameters.put(TestParameters.DEFAULT_ITEM_TYPE, "I:cm:cmobject"); clientContext = new OpenCMISClientContext(BindingType.ATOMPUB, MessageFormat.format(CMIS_URL, "localhost", String.valueOf(port), "alfresco", network.getId(), "public"), "admin@" + network.getId(), "admin", cmisParameters, getTestFixture().getJettyComponent().getApplicationContext()); overrideVersionableAspectProperties(getTestFixture().getJettyComponent().getApplicationContext()); }
Example #6
Source File: TestRemovePermissions.java From alfresco-remote-api with GNU Lesser General Public License v3.0 | 6 votes |
protected Session getBROWSER_11_Session() { try { Map<String, String> parameter = new HashMap<String, String>(); int port = getTestFixture().getJettyComponent().getPort(); parameter.put(SessionParameter.BINDING_TYPE, BindingType.BROWSER.value()); parameter.put(SessionParameter.BROWSER_URL, MessageFormat.format(BROWSE_URL_11, DEFAULT_HOSTNAME, String.valueOf(port))); parameter.put(SessionParameter.COOKIES, "true"); parameter.put(SessionParameter.USER, ADMIN_USER); parameter.put(SessionParameter.PASSWORD, ADMIN_PASSWORD); SessionFactory sessionFactory = SessionFactoryImpl.newInstance(); parameter.put(SessionParameter.REPOSITORY_ID, sessionFactory.getRepositories(parameter).get(0).getId()); return sessionFactory.createSession(parameter); } catch (Exception ex) { logger.error(ex); } return null; }
Example #7
Source File: TestRemovePermissions.java From alfresco-remote-api with GNU Lesser General Public License v3.0 | 6 votes |
protected Session getATOMPUB_11_Session() { try { Map<String, String> parameters = new HashMap<String, String>(); int port = getTestFixture().getJettyComponent().getPort(); parameters.put(SessionParameter.USER, ADMIN_USER); parameters.put(SessionParameter.PASSWORD, ADMIN_PASSWORD); parameters.put(SessionParameter.ATOMPUB_URL, MessageFormat.format(ATOMPUB_URL_11, DEFAULT_HOSTNAME, String.valueOf(port))); parameters.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value()); SessionFactory sessionFactory = SessionFactoryImpl.newInstance(); parameters.put(SessionParameter.REPOSITORY_ID, sessionFactory.getRepositories(parameters).get(0).getId()); return sessionFactory.createSession(parameters); } catch (Exception ex) { logger.error(ex); } return null; }
Example #8
Source File: TestRemovePermissions.java From alfresco-remote-api with GNU Lesser General Public License v3.0 | 6 votes |
protected Session getATOMPUB_10_Session() { try { Map<String, String> parameters = new HashMap<String, String>(); int port = getTestFixture().getJettyComponent().getPort(); parameters.put(SessionParameter.USER, ADMIN_USER); parameters.put(SessionParameter.PASSWORD, ADMIN_PASSWORD); parameters.put(SessionParameter.ATOMPUB_URL, MessageFormat.format(ATOMPUB_URL_OC, DEFAULT_HOSTNAME, String.valueOf(port))); parameters.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value()); SessionFactory sessionFactory = SessionFactoryImpl.newInstance(); parameters.put(SessionParameter.REPOSITORY_ID, sessionFactory.getRepositories(parameters).get(0).getId()); return sessionFactory.createSession(parameters); } catch (Exception ex) { logger.error(ex); } return null; }
Example #9
Source File: TestPublicApiBrowser11TCK.java From alfresco-remote-api with GNU Lesser General Public License v3.0 | 6 votes |
@Before public void before() throws Exception { // see REPO-1524 // the tests are always run on PostgreSQL only // Dialect dialect = (Dialect) applicationContext.getBean("dialect"); // assumeFalse(dialect instanceof Oracle9Dialect); int port = getTestFixture().getJettyComponent().getPort(); TestNetwork network = getTestFixture().getRandomNetwork(); Map<String, String> cmisParameters = new HashMap<String, String>(); cmisParameters.put(TestParameters.DEFAULT_RELATIONSHIP_TYPE, "R:cm:replaces"); cmisParameters.put(TestParameters.DEFAULT_SECONDARY_TYPE, "P:cm:author"); cmisParameters.put(TestParameters.DEFAULT_ITEM_TYPE, "I:cm:cmobject"); clientContext = new OpenCMISClientContext(BindingType.BROWSER, MessageFormat.format(CMIS_URL, "localhost", String.valueOf(port), "alfresco", network.getId(), "public"), "admin@" + network.getId(), "admin", cmisParameters, getTestFixture().getJettyComponent().getApplicationContext()); overrideVersionableAspectProperties(getTestFixture().getJettyComponent().getApplicationContext()); }
Example #10
Source File: CMISDataCreatorTest.java From SearchServices with GNU Lesser General Public License v3.0 | 6 votes |
private static Session getSession(String user, String pwd) { String url = "http://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.1/atom"; SessionFactory factory = SessionFactoryImpl.newInstance(); Map<String, String> parameter = new HashMap<String, String>(); parameter.put(SessionParameter.USER, user); parameter.put(SessionParameter.PASSWORD, pwd); parameter.put(SessionParameter.ATOMPUB_URL, url); parameter.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value()); List<Repository> repositories = factory.getRepositories(parameter); Session session = repositories.get(0).createSession(); return session; }
Example #11
Source File: PublicApiClient.java From alfresco-remote-api with GNU Lesser General Public License v3.0 | 5 votes |
/** * Get CMIS repositories (Enterprise AtomPub CMIS binding) * * @return List<Repository> */ public List<Repository> getCMISRepositories() { List<Repository> repositories = null; RequestContext rc = getRequestContext(); if(rc == null) { throw new RuntimeException("Must set a request context"); } UserData userData = findUser(rc.getRunAsUser()); if(userData != null) { // default factory implementation SessionFactory factory = SessionFactoryImpl.newInstance(); Map<String, String> parameters = new HashMap<String, String>(); // user credentials parameters.put(SessionParameter.USER, rc.getRunAsUser()); parameters.put(SessionParameter.PASSWORD, userData.getPassword()); // connection settings parameters.put(SessionParameter.ATOMPUB_URL, client.getCmisUrl(null, null)); parameters.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value()); repositories = factory.getRepositories(parameters); } return repositories; }
Example #12
Source File: CMISDispatcherRegistry.java From alfresco-remote-api with GNU Lesser General Public License v3.0 | 5 votes |
public BindingType getOpenCmisBinding() { BindingType bindingType = null; if(this == atom) { bindingType = BindingType.ATOMPUB; } else if(this == browser) { bindingType = BindingType.BROWSER; } return bindingType; }
Example #13
Source File: PublicApiClient.java From alfresco-remote-api with GNU Lesser General Public License v3.0 | 5 votes |
public List<String> getNetworkIds(String version) { RequestContext rc = getRequestContext(); UserData userData = findUser(rc.getRunAsUser()); if(userData == null) { throw new RuntimeException("Must provide a valid username"); } SessionFactory factory = SessionFactoryImpl.newInstance(); Map<String, String> parameters = new HashMap<String, String>(); // connection settings parameters.put(SessionParameter.ATOMPUB_URL, client.getPublicApiCmisUrl(null, Binding.atom, version, null)); parameters.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value()); // user credentials parameters.put(SessionParameter.USER, rc.getRunAsUser()); parameters.put(SessionParameter.PASSWORD, userData.getPassword()); List<Repository> repositories = factory.getRepositories(parameters); List<String> repositoryIds = new ArrayList<String>(repositories.size()); for(Repository repository : repositories) { repositoryIds.add(repository.getId()); } return repositoryIds; }
Example #14
Source File: TestEnterpriseAtomPubTCK.java From alfresco-remote-api with GNU Lesser General Public License v3.0 | 5 votes |
@Before public void setup() throws Exception { JettyComponent jetty = getTestFixture().getJettyComponent(); final SearchService searchService = (SearchService)jetty.getApplicationContext().getBean("searchService");; final NodeService nodeService = (NodeService)jetty.getApplicationContext().getBean("nodeService"); final FileFolderService fileFolderService = (FileFolderService)jetty.getApplicationContext().getBean("fileFolderService"); final NamespaceService namespaceService = (NamespaceService)jetty.getApplicationContext().getBean("namespaceService"); final TransactionService transactionService = (TransactionService)jetty.getApplicationContext().getBean("transactionService"); final String name = "abc" + System.currentTimeMillis(); transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Void>() { @Override public Void execute() throws Throwable { AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName()); Repository repositoryHelper = (Repository)jetty.getApplicationContext().getBean("repositoryHelper"); NodeRef companyHome = repositoryHelper.getCompanyHome(); fileFolderService.create(companyHome, name, ContentModel.TYPE_FOLDER).getNodeRef(); return null; } }, false, true); int port = jetty.getPort(); Map<String, String> cmisParameters = new HashMap<String, String>(); cmisParameters.put(TestParameters.DEFAULT_RELATIONSHIP_TYPE, "R:cm:replaces"); cmisParameters.put(TestParameters.DEFAULT_TEST_FOLDER_PARENT, "/" + name); clientContext = new OpenCMISClientContext(BindingType.ATOMPUB, MessageFormat.format(CMIS_URL, "localhost", String.valueOf(port), "alfresco"), "admin", "admin", cmisParameters, jetty.getApplicationContext()); overrideVersionableAspectProperties(jetty.getApplicationContext()); }
Example #15
Source File: SampleClient.java From document-management-software with GNU Lesser General Public License v3.0 | 5 votes |
/** * Connect to logicaldoc repository * * @return root folder object */ private static Folder connect(String username, String password) { SessionFactory sessionFactory = SessionFactoryImpl.newInstance(); Map<String, String> parameter = new HashMap<String, String>(); parameter.put(SessionParameter.USER, username); parameter.put(SessionParameter.PASSWORD, password); parameter.put(SessionParameter.ATOMPUB_URL, CONNECTION_URL); parameter.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value()); parameter.put(SessionParameter.REPOSITORY_ID, Long.toString(5L)); session = sessionFactory.createSession(parameter); return session.getRootFolder(); }
Example #16
Source File: CmisIntegrationTest.java From wildfly-camel with Apache License 2.0 | 5 votes |
private Session createSession() { SessionFactory sessionFactory = SessionFactoryImpl.newInstance(); Map<String, String> parameter = new HashMap<String, String>(); parameter.put(SessionParameter.ATOMPUB_URL, "http://127.0.0.1:8080/chemistry-opencmis-server-inmemory/atom11/atom11"); parameter.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value()); Repository repository = sessionFactory.getRepositories(parameter).get(0); return repository.createSession(); }
Example #17
Source File: TestRemovePermissions.java From alfresco-remote-api with GNU Lesser General Public License v3.0 | 4 votes |
protected Session getWEBSERVICE_10_Session() { try { SessionFactory sessionFactory = SessionFactoryImpl.newInstance(); int port = 8080; Map<String, String> parameters = new HashMap<String, String>(); parameters.put(SessionParameter.USER, ADMIN_USER); parameters.put(SessionParameter.PASSWORD, ADMIN_PASSWORD); parameters.put(SessionParameter.BINDING_TYPE, BindingType.WEBSERVICES.value()); parameters.put(SessionParameter.WEBSERVICES_ACL_SERVICE, MessageFormat.format(ACLSERVICE_OC_URL, DEFAULT_HOSTNAME, String.valueOf(port))); parameters.put(SessionParameter.WEBSERVICES_DISCOVERY_SERVICE, MessageFormat.format(DISCOVERYSERVICE_OC_URL, DEFAULT_HOSTNAME, String.valueOf(port))); parameters.put(SessionParameter.WEBSERVICES_MULTIFILING_SERVICE, MessageFormat.format(MULTIFILINGSERVICE_OC_URL, DEFAULT_HOSTNAME, String.valueOf(port))); parameters.put(SessionParameter.WEBSERVICES_NAVIGATION_SERVICE, MessageFormat.format(NAVIGATIONSERVICE_OC_URL, DEFAULT_HOSTNAME, String.valueOf(port))); parameters.put(SessionParameter.WEBSERVICES_OBJECT_SERVICE, MessageFormat.format(OBJECTSERVICE_OC_URL, DEFAULT_HOSTNAME, String.valueOf(port))); parameters.put(SessionParameter.WEBSERVICES_POLICY_SERVICE, MessageFormat.format(POLICYSERVICE_OC_URL, DEFAULT_HOSTNAME, String.valueOf(port))); parameters.put(SessionParameter.WEBSERVICES_RELATIONSHIP_SERVICE, MessageFormat.format(RELATIONSHIPSERVICE_OC_URL, DEFAULT_HOSTNAME, String.valueOf(port))); parameters.put(SessionParameter.WEBSERVICES_REPOSITORY_SERVICE, MessageFormat.format(REPOSITORYSERVICE_OC_URL, DEFAULT_HOSTNAME, String.valueOf(port))); parameters.put(SessionParameter.WEBSERVICES_VERSIONING_SERVICE, MessageFormat.format(REPOSITORYSERVICE_OC_URL, DEFAULT_HOSTNAME, String.valueOf(port))); parameters.put(SessionParameter.REPOSITORY_ID, sessionFactory.getRepositories(parameters).get(0).getId()); return sessionFactory.createSession(parameters); } catch (Exception ex) { logger.error(ex); } return null; }
Example #18
Source File: OpenCMISClientContext.java From alfresco-remote-api with GNU Lesser General Public License v3.0 | 4 votes |
public OpenCMISClientContext(BindingType bindingType, String url, String username, String password, Map<String, String> parameters) throws IOException { this(bindingType, url, username, password, parameters, null); }
Example #19
Source File: CmisSenderTest.java From iaf with Apache License 2.0 | 4 votes |
@Test() public void getterSetterBindingTypeSuccess() throws ConfigurationException { sender.setBindingType(BindingType.BROWSER.value()); sender.setBindingType(BindingType.ATOMPUB.value()); sender.setBindingType(BindingType.WEBSERVICES.value()); }