org.activiti.engine.impl.cfg.multitenant.TenantAwareDataSource Maven / Gradle / Ivy
The newest version!
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.engine.impl.cfg.multitenant;
import org.activiti.engine.ActivitiException;
import javax.sql.DataSource;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.SQLFeatureNotSupportedException;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.Logger;
/**
* A {@link DataSource} implementation that switches the currently used datasource based on the
* current values of the {@link TenantInfoHolder}.
*
* When a {@link Connection} is requested from this {@link DataSource}, the correct {@link DataSource}
* for the current tenant will be determined and used.
*
* Heavily influenced and inspired by Spring's AbstractRoutingDataSource.
*
* @deprecated multi-tenant code will be removed in future version of Activiti and Activiti Cloud
*/
@Deprecated
public class TenantAwareDataSource implements DataSource {
protected TenantInfoHolder tenantInfoHolder;
protected Map