Search in sources :

Example 1 with PropertyAccessor

use of com.ctrip.framework.dal.cluster.client.base.PropertyAccessor in project dal by ctripcorp.

the class ShardStrategyElement method getTableProperty.

protected String getTableProperty(String tableName, String propertyName, String defaultValue) {
    PropertyAccessor properties = getTableProperties(tableName);
    String property = properties.getProperty(propertyName);
    return property != null ? property : defaultValue;
}
Also used : PropertyAccessor(com.ctrip.framework.dal.cluster.client.base.PropertyAccessor)

Example 2 with PropertyAccessor

use of com.ctrip.framework.dal.cluster.client.base.PropertyAccessor in project dal by ctripcorp.

the class ShardStrategyElement method start.

@Override
public void start() {
    for (TablesElement tablesElement : tablesElements) {
        tablesElement.merge(this);
        tablesElement.start();
        for (String tableName : tablesElement.getTableNames()) {
            PropertyAccessor properties = tablesElement.getTableProperties(tableName);
            if (tableProperties.put(tableName, properties) != null)
                throw new ClusterRuntimeException("duplicate table names defined under ShardStrategyElement");
        }
    }
}
Also used : PropertyAccessor(com.ctrip.framework.dal.cluster.client.base.PropertyAccessor) ClusterRuntimeException(com.ctrip.framework.dal.cluster.client.exception.ClusterRuntimeException)

Aggregations

PropertyAccessor (com.ctrip.framework.dal.cluster.client.base.PropertyAccessor)2 ClusterRuntimeException (com.ctrip.framework.dal.cluster.client.exception.ClusterRuntimeException)1