当前位置: 首页>>代码示例>>Java>>正文


Java SessionParameter类代码示例

本文整理汇总了Java中org.apache.chemistry.opencmis.commons.SessionParameter的典型用法代码示例。如果您正苦于以下问题:Java SessionParameter类的具体用法?Java SessionParameter怎么用?Java SessionParameter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SessionParameter类属于org.apache.chemistry.opencmis.commons包,在下文中一共展示了SessionParameter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getRepository

import org.apache.chemistry.opencmis.commons.SessionParameter; //导入依赖的package包/类
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;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:19,代码来源:OpenCmisLocalTest.java

示例2: cmisSession

import org.apache.chemistry.opencmis.commons.SessionParameter; //导入依赖的package包/类
/**
 * @return la session CMIS
 */
private Session cmisSession(){
	if (url == null || url.equals("") || repository == null || repository.equals("") || user == null || user.equals("")){
		return null;
	}		
	
	try{
		// default factory implementation
		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);
		if (session == null){
			logger.error("Stockage de fichier - Impossible de se connecter au serveur de fichier CMIS");
			return null;
		}else{
			if (directoryExistCMIS(idFolderGestionnaire,session) && directoryExistCMIS(idFolderCandidat,session)){
				return session;
			}
		}
		return null;		
	}catch (Exception e){
		logger.error("Stockage de fichier - Impossible de se connecter au serveur de fichier CMIS", e);
		return null;
	}
}
 
开发者ID:EsupPortail,项目名称:esup-ecandidat,代码行数:38,代码来源:FileManagerCmisImpl.java

示例3: testCanConnectCMISUsingDefaultTenantImpl

import org.apache.chemistry.opencmis.commons.SessionParameter; //导入依赖的package包/类
private void testCanConnectCMISUsingDefaultTenantImpl(Binding binding, String cmisVersion)
{
    String url = httpClient.getPublicApiCmisUrl(TenantUtil.DEFAULT_TENANT, binding, cmisVersion, null);
    
    Map<String, String> parameters = new HashMap<String, String>();
    
    // user credentials
    parameters.put(SessionParameter.USER, "admin");
    parameters.put(SessionParameter.PASSWORD, "admin");
    
    parameters.put(SessionParameter.ATOMPUB_URL, url);
    parameters.put(SessionParameter.BROWSER_URL, url);
    parameters.put(SessionParameter.BINDING_TYPE, binding.getOpenCmisBinding().value());
    
    SessionFactory factory = SessionFactoryImpl.newInstance();
    // perform request : http://host:port/alfresco/api/-default-/public/cmis/versions/${cmisVersion}/${binding}
    List<Repository> repositories = factory.getRepositories(parameters);
    
    assertTrue(repositories.size() > 0);
    
    parameters.put(SessionParameter.REPOSITORY_ID, TenantUtil.DEFAULT_TENANT);
    Session session = factory.createSession(parameters);
    // perform request : http://host:port/alfresco/api/-default-/public/cmis/versions/${cmisVersion}/${binding}/type?id=cmis:document
    ObjectType objectType = session.getTypeDefinition("cmis:document");
    
    assertNotNull(objectType);
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:28,代码来源:TestCMIS.java

示例4: getATOMPUB_10_Session

import org.apache.chemistry.opencmis.commons.SessionParameter; //导入依赖的package包/类
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;
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:24,代码来源:TestRemovePermissions.java

示例5: getATOMPUB_11_Session

import org.apache.chemistry.opencmis.commons.SessionParameter; //导入依赖的package包/类
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;
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:25,代码来源:TestRemovePermissions.java

示例6: getBROWSER_11_Session

import org.apache.chemistry.opencmis.commons.SessionParameter; //导入依赖的package包/类
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;
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:27,代码来源:TestRemovePermissions.java

示例7: createCMISSession

import org.apache.chemistry.opencmis.commons.SessionParameter; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:34,代码来源:PublicApiClient.java

示例8: OpenCMISClientContext

import org.apache.chemistry.opencmis.commons.SessionParameter; //导入依赖的package包/类
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();
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:25,代码来源:OpenCMISClientContext.java

示例9: createSession

import org.apache.chemistry.opencmis.commons.SessionParameter; //导入依赖的package包/类
public static Session createSession(AlfrescoConfig config) {
	mLog.debug("Start createSession()");

	Map<String, String> lMapParameter = new HashMap<String, String>();

	// I parametri di connessione vengono impostati per usare il binding AtomPub CMIS 1.1
	lMapParameter.put(SessionParameter.USER, config.getUsername());
	lMapParameter.put(SessionParameter.PASSWORD, config.getPassword());
	lMapParameter.put(SessionParameter.ATOMPUB_URL, buildUrl(ATOMPUB_CMIS11_URL_TEMPLATE, config));
	lMapParameter.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());

	// creo la session factory
	SessionFactory lSessionFactory = SessionFactoryImpl.newInstance();

	// creo la sessione connessa al repository
	Session lSession = lSessionFactory.getRepositories(lMapParameter).get(0).createSession();

	mLog.debug("End createSession()");
	return lSession;
}
 
开发者ID:MakeITBologna,项目名称:zefiro,代码行数:21,代码来源:AlfrescoHelper.java

示例10: createAtomPubSession

import org.apache.chemistry.opencmis.commons.SessionParameter; //导入依赖的package包/类
/**
 * Create a new CMIS session to an AtomPub endpoint.
 *
 * @param endPoint Endpoint URL
 * @param user User
 * @param password Password
 * @return New CMIS session
 */
public static Session createAtomPubSession(String endPoint, String user, String password) {
    // Set repository parameters
    Map<String, String> parameters = new HashMap<String, String>();
    parameters.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());
    parameters.put(SessionParameter.ATOMPUB_URL, endPoint);
    parameters.put(SessionParameter.USER, user);
    parameters.put(SessionParameter.PASSWORD, password);

    // Create the session
    SessionFactory factory = SessionFactoryImpl.newInstance();
    List<Repository> repositories = factory.getRepositories(parameters);
    Session session = repositories.get(0).createSession();
    session.setDefaultContext(defaultOperationContext());

    return session;
}
 
开发者ID:sismics,项目名称:play-cmis,代码行数:25,代码来源:CmisUtil.java

示例11: createSession

import org.apache.chemistry.opencmis.commons.SessionParameter; //导入依赖的package包/类
private Session createSession() {
    logger.info("cmisUrl=" + cmisUrl + " and cmisUser=" + cmisUsername + " and cmisPassword=" + cmisPassword);
    SessionFactory factory = SessionFactoryImpl.newInstance();
    Map<String, String> parameter = new HashMap<String, String>();

    // user credentials
    parameter.put(SessionParameter.USER, cmisUsername);
    parameter.put(SessionParameter.PASSWORD, cmisPassword);

    // connection settings
    parameter.put(SessionParameter.ATOMPUB_URL, cmisUrl);
    parameter.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());

    parameter.put(SessionParameter.OBJECT_FACTORY_CLASS, "org.alfresco.cmis.client.impl.AlfrescoObjectFactoryImpl");

    List<Repository> repositories = factory.getRepositories(parameter);
    Session session = repositories.get(0).createSession();

    return session;
}
 
开发者ID:xenit-eu,项目名称:move2alf,代码行数:21,代码来源:SACMISInput.java

示例12: createSession

import org.apache.chemistry.opencmis.commons.SessionParameter; //导入依赖的package包/类
private Session createSession() {
    SessionFactory factory = SessionFactoryImpl.newInstance();
    Map<String, String> parameter = new HashMap<String, String>();

    // user credentials
    parameter.put(SessionParameter.USER, getParameter(SACMISInput.PARAM_CMIS_USERNAME));
    parameter.put(SessionParameter.PASSWORD, getParameter(SACMISInput.PARAM_CMIS_PASSWORD));

    // connection settings
    parameter.put(SessionParameter.ATOMPUB_URL, getParameter(SACMISInput.PARAM_CMIS_URL));
    parameter.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());

    List<Repository> repositories = factory.getRepositories(parameter);
    Session session = repositories.get(0).createSession();

    return session;
}
 
开发者ID:xenit-eu,项目名称:move2alf,代码行数:18,代码来源:CmisQuery.java

示例13: createCMISSession

import org.apache.chemistry.opencmis.commons.SessionParameter; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:34,代码来源:PublicApiClient.java

示例14: getSession

import org.apache.chemistry.opencmis.commons.SessionParameter; //导入依赖的package包/类
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;
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:17,代码来源:CMISDataCreatorTest.java

示例15: connect

import org.apache.chemistry.opencmis.commons.SessionParameter; //导入依赖的package包/类
@Override
public ScriptCMISRepository connect(final String serverId, final ScriptCMISOperationContext ctx)
{
    // TODO GET the information form configuration file
    final Map<String, String> parameters = new HashMap<String, String>();
    parameters.put(SessionParameter.USER, "admin");
    parameters.put(SessionParameter.PASSWORD, "admin");
    parameters.put(SessionParameter.AUTHENTICATION_PROVIDER_CLASS, CertificateNotValidatingAuthenticationProvider.class.getName());
    parameters.put(SessionParameter.BROWSER_URL, "http://cmis.alfresco.com/cmisbrowser");
    parameters.put(SessionParameter.BINDING_TYPE, BindingType.BROWSER.value());

    final SessionFactoryImpl sessionFactory = SessionFactoryImpl.newInstance();
    final List<Repository> repositories = sessionFactory.getRepositories(parameters);
    final Repository mainRepository = repositories.get(0);
    parameters.put(SessionParameter.REPOSITORY_ID, mainRepository.getId());

    final Session session = sessionFactory.createSession(parameters);
    session.setDefaultContext(DefaultTypeConverter.INSTANCE.convert(OperationContext.class, ctx));

    final RhinoCMISRepositoryImpl scriptCMISRepository = new RhinoCMISRepositoryImpl(session);
    return scriptCMISRepository;
}
 
开发者ID:AFaust,项目名称:alfresco-cmis-documentlist,代码行数:23,代码来源:RhinoCMISConnectorImpl.java


注:本文中的org.apache.chemistry.opencmis.commons.SessionParameter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。