// Path: uncode-dal/src/main/java/cn/uncode/dal/internal/shards/bo/Shard.java
// public class Shard {
// 	
// 	private Map<Long, String> partition = new HashMap<Long, String>();
// 	private List<String> allPartition = new ArrayList<String>();
// 	
// 	public Shard(String value){
// 		//one:1-2,two:2
// 		if(StringUtils.isNotEmpty(value)){
// 			String[] sds = value.split(",");
// 			for(String item:sds){
// 				String[] its = item.split(":");
// 				String[] se = its[1].split("-");
// 				if(se.length > 1){
// 					for(int i = Integer.valueOf(se[0]);i <= Integer.valueOf(se[1]); i++){
// 						partition.put((long)i, its[0]);
// 					}
// 				}else{
// 					partition.put(Long.valueOf(se[0]), its[0]);
// 				}
// 				allPartition.add(its[0]);
// 			}
// 		}
// 	}
// 
// 	public Map<Long, String> getPartition() {
// 		return partition;
// 	}
// 
// 	public List<String> getAllPartition() {
// 		return allPartition;
// 	}
// 	
// 
// }
// 
// Path: uncode-dal/src/main/java/cn/uncode/dal/internal/shards/strategy/AbstractShardStrategyFactory.java
// public abstract class AbstractShardStrategyFactory implements ShardStrategyFactory, InitializingBean {
// 	
// 	protected Map<String, String> tableRules = new HashMap<String, String>();
// 	
// 	protected Map<String, Shard> tableShard = new HashMap<String, Shard>();
// 	
// 	public Map<String, Shard> getTableShard() {
// 		return tableShard;
// 	}
// 
// 	public void setTableRules(Map<String, String> tableRules) {
// 		this.tableRules = tableRules;
// 	}
// 
// 	@Override
// 	public void afterPropertiesSet() throws Exception {
// 		for (Entry<String, String> item:tableRules.entrySet()) {
// 			tableShard.put(item.getKey(), new Shard(item.getValue()));
// 		}
// 		
// 	}
// 	
// 
// }
// 
// Path: uncode-dal/src/main/java/cn/uncode/dal/internal/shards/strategy/ShardStrategy.java
// public interface ShardStrategy {
// 	
// 	int SHARDS_GROUP_TOTAL = 100;
// 	
// 	String[] selectShardForNewObject(long id);
// 	String[] selectShardFromData(String table);
// 	String[] selectShardForPrimaryKey(String table, Object id);
// 	
// 	
// /*	ShardSelectionStrategy getShardSelectionStrategy();
// 
// 	ShardResolutionStrategy getShardResolutionStrategy();
// 
// 	ShardAccessStrategy getShardAccessStrategy();
// 	
// 	ShardReduceStrategy getShardReduceStrategy();*/
// 	
// }


import cn.uncode.dal.internal.shards.bo.Shard;
import cn.uncode.dal.internal.shards.strategy.AbstractShardStrategyFactory;
import cn.uncode.dal.internal.shards.strategy.ShardStrategy;
package cn.uncode.dal.internal.shards.strategy.impl;


public class DefaultShardStrategyFactory extends AbstractShardStrategyFactory{

	@Override
	public ShardStrategy newShardStrategy() {
		return new ShardStrategy(){
			@Override
			public String[] selectShardFromData(String table) {
				if(tableShard.containsKey(table)){
// Path: uncode-dal/src/main/java/cn/uncode/dal/internal/shards/bo/Shard.java
// public class Shard {
// 	
// 	private Map<Long, String> partition = new HashMap<Long, String>();
// 	private List<String> allPartition = new ArrayList<String>();
// 	
// 	public Shard(String value){
// 		//one:1-2,two:2
// 		if(StringUtils.isNotEmpty(value)){
// 			String[] sds = value.split(",");
// 			for(String item:sds){
// 				String[] its = item.split(":");
// 				String[] se = its[1].split("-");
// 				if(se.length > 1){
// 					for(int i = Integer.valueOf(se[0]);i <= Integer.valueOf(se[1]); i++){
// 						partition.put((long)i, its[0]);
// 					}
// 				}else{
// 					partition.put(Long.valueOf(se[0]), its[0]);
// 				}
// 				allPartition.add(its[0]);
// 			}
// 		}
// 	}
// 
// 	public Map<Long, String> getPartition() {
// 		return partition;
// 	}
// 
// 	public List<String> getAllPartition() {
// 		return allPartition;
// 	}
// 	
// 
// }
// 
// Path: uncode-dal/src/main/java/cn/uncode/dal/internal/shards/strategy/AbstractShardStrategyFactory.java
// public abstract class AbstractShardStrategyFactory implements ShardStrategyFactory, InitializingBean {
// 	
// 	protected Map<String, String> tableRules = new HashMap<String, String>();
// 	
// 	protected Map<String, Shard> tableShard = new HashMap<String, Shard>();
// 	
// 	public Map<String, Shard> getTableShard() {
// 		return tableShard;
// 	}
// 
// 	public void setTableRules(Map<String, String> tableRules) {
// 		this.tableRules = tableRules;
// 	}
// 
// 	@Override
// 	public void afterPropertiesSet() throws Exception {
// 		for (Entry<String, String> item:tableRules.entrySet()) {
// 			tableShard.put(item.getKey(), new Shard(item.getValue()));
// 		}
// 		
// 	}
// 	
// 
// }
// 
// Path: uncode-dal/src/main/java/cn/uncode/dal/internal/shards/strategy/ShardStrategy.java
// public interface ShardStrategy {
// 	
// 	int SHARDS_GROUP_TOTAL = 100;
// 	
// 	String[] selectShardForNewObject(long id);
// 	String[] selectShardFromData(String table);
// 	String[] selectShardForPrimaryKey(String table, Object id);
// 	
// 	
// /*	ShardSelectionStrategy getShardSelectionStrategy();
// 
// 	ShardResolutionStrategy getShardResolutionStrategy();
// 
// 	ShardAccessStrategy getShardAccessStrategy();
// 	
// 	ShardReduceStrategy getShardReduceStrategy();*/
// 	
// }


// Path: uncode-dal/src/main/java/cn/uncode/dal/internal/shards/strategy/impl/DefaultShardStrategyFactory.java
import cn.uncode.dal.internal.shards.bo.Shard;
import cn.uncode.dal.internal.shards.strategy.AbstractShardStrategyFactory;
import cn.uncode.dal.internal.shards.strategy.ShardStrategy;

package cn.uncode.dal.internal.shards.strategy.impl;


public class DefaultShardStrategyFactory extends AbstractShardStrategyFactory{

	@Override
	public ShardStrategy newShardStrategy() {
		return new ShardStrategy(){
			@Override
			public String[] selectShardFromData(String table) {
				if(tableShard.containsKey(table)){
					Shard shard = tableShard.get(table);