/*
* Copyright (C) 2005-2011 Alfresco Software Limited.
*
* This file is part of Alfresco
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see .
*/
package org.alfresco.repo.cmis.client;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.locks.ReentrantReadWriteLock;
import org.alfresco.service.cmr.security.AuthenticationService;
import org.apache.chemistry.opencmis.client.api.Repository;
import org.apache.chemistry.opencmis.client.api.Session;
import org.apache.chemistry.opencmis.client.api.SessionFactory;
import org.apache.chemistry.opencmis.client.runtime.SessionFactoryImpl;
import org.apache.chemistry.opencmis.commons.SessionParameter;
import org.springframework.beans.factory.InitializingBean;
public abstract class AbstractCMISConnectionManagerImpl implements CMISConnectionManager, InitializingBean
{
public static final String SERVER_NAME = "name";
public static final String SERVER_DESCRIPTION = "description";
public static final String LOCAL_CONNECTION_ID = "local";
public static final char RESERVED_ID_CHAR = '$';
protected AuthenticationService authenticationService;
protected SessionFactory sessionFactory;
protected LinkedHashMap sharedConnections;
protected LinkedHashMap userConnections;
protected int userConnectionsCapacity = 1000;
protected int sharedConnectionsCapacity = 1000;
protected Map servers;
protected ReentrantReadWriteLock lock = new ReentrantReadWriteLock();
public void setAuthenticationService(AuthenticationService authenticationService)
{
this.authenticationService = authenticationService;
}
public void setUserConnectionsCapacity(int userConnectionsCapacity)
{
this.userConnectionsCapacity = userConnectionsCapacity;
}
public void setSharedConnectionsCapacity(int sharedConnectionsCapacity)
{
this.sharedConnectionsCapacity = sharedConnectionsCapacity;
}
public void setServers(List