package com.ctrip.framework.dal.cluster.client.cluster;

public enum RouteStrategyEnum {

    READ_MASTER("ReadMasterStrategy", "com.ctrip.platform.dal.cluster.shard.read.ReadMasterStrategy"),
    READ_SLAVES_FIRST("ReadSlavesFirstStrategy", "com.ctrip.platform.dal.cluster.shard.read.ReadSlavesFirstStrategy"),
    READ_SLAVES_ONLY("ReadSlavesOnlyStrategy", "com.ctrip.platform.dal.cluster.shard.read.ReadSlavesOnlyStrategy"),
    READ_CURRENT_ZONE_SLAVES_FIRST("ReadCurrentZoneSlavesFirstStrategy", "com.ctrip.platform.dal.cluster.shard.read.ReadCurrentZoneSlavesFirstStrategy"),
    READ_CURRENT_ZONE_SLAVES_ONLY("ReadCurrentZoneSlavesOnlyStrategy", "com.ctrip.platform.dal.cluster.shard.read.ReadCurrentZoneSlavesOnlyStrategy"),
    READ_MASTER_ZONE_SLAVES_FIRST("ReadMasterZoneSlavesFirstStrategy", "com.ctrip.platform.dal.cluster.shard.read.ReadMasterZoneSlavesFirstStrategy"),
    READ_MASTER_ZONE_SLAVES_ONLY("ReadMasterZoneSlavesOnlyStrategy", "com.ctrip.platform.dal.cluster.shard.read.ReadMasterZoneSlavesOnlyStrategy"),

    WRITE_ORDERED("OrderedAccessStrategy", "com.ctrip.platform.dal.dao.datasource.cluster.strategy.multi.mgr.MGRStrategy"),
    WRITE_CURRENT_ZONE_FIRST("LocalizedAccessStrategy", "com.ctrip.platform.dal.dao.datasource.cluster.strategy.multi.ob.OBStrategy");

    private String alias;
    private String clazz;

    RouteStrategyEnum(String alias, String clazz) {
        this.alias = alias;
        this.clazz = clazz;
    }

    public static String parse(String strategyName) {
        for (RouteStrategyEnum routeStrategyEnum : RouteStrategyEnum.values()) {
            if (routeStrategyEnum.name().equalsIgnoreCase(strategyName) || routeStrategyEnum.getAlias().equalsIgnoreCase(strategyName))
                return routeStrategyEnum.clazz;
        }
        return strategyName;
    }

    public String getClazz() {
        return this.clazz;
    }

    public String getAlias() {
        return alias;
    }
}

@@ -50,16 +50,245 @@
 uster;%0A%0A
+import com.ctrip.framework.dal.cluster.client.shard.read.*;%0Aimport com.ctrip.platform.dal.dao.datasource.cluster.strategy.multi.mgr.MGRStrategy;%0Aimport com.ctrip.platform.dal.dao.datasource.cluster.strategy.multi.ob.OBStrategy;%0A%0A
 public e
@@ -354,51 +354,8 @@
 y%22, 
-%22com.ctrip.platform.dal.cluster.shard.read.
 Read
@@ -360,33 +360,48 @@
 adMasterStrategy
-%22
+.class.getName()
 ),%0A    READ_SLAV
@@ -440,51 +440,8 @@
 y%22, 
-%22com.ctrip.platform.dal.cluster.shard.read.
 Read
@@ -451,33 +451,48 @@
 vesFirstStrategy
-%22
+.class.getName()
 ),%0A    READ_SLAV
@@ -529,51 +529,8 @@
 y%22, 
-%22com.ctrip.platform.dal.cluster.shard.read.
 Read
@@ -539,33 +539,48 @@
 avesOnlyStrategy
-%22
+.class.getName()
 ),%0A    READ_CURR
@@ -643,51 +643,8 @@
 y%22, 
-%22com.ctrip.platform.dal.cluster.shard.read.
 Read
@@ -665,33 +665,48 @@
 vesFirstStrategy
-%22
+.class.getName()
 ),%0A    READ_CURR
@@ -767,51 +767,8 @@
 y%22, 
-%22com.ctrip.platform.dal.cluster.shard.read.
 Read
@@ -788,33 +788,48 @@
 avesOnlyStrategy
-%22
+.class.getName()
 ),%0A    READ_MAST
@@ -890,51 +890,8 @@
 y%22, 
-%22com.ctrip.platform.dal.cluster.shard.read.
 Read
@@ -915,25 +915,40 @@
 irstStrategy
-%22
+.class.getName()
 ),%0A    READ_
@@ -1011,51 +1011,8 @@
 y%22, 
-%22com.ctrip.platform.dal.cluster.shard.read.
 Read
@@ -1039,17 +1039,32 @@
 Strategy
-%22
+.class.getName()
 ),%0A%0A    
@@ -1106,221 +1106,120 @@
 y%22, 
-%22com.ctrip.platform.dal.dao.datasource.cluster.strategy.multi.mgr.MGRStrategy%22),%0A    WRITE_CURRENT_ZONE_FIRST(%22LocalizedAccessStrategy%22, %22com.ctrip.platform.dal.dao.datasource.cluster.strategy.multi.ob.OBStrategy%22
+MGRStrategy.class.getName()),%0A    WRITE_CURRENT_ZONE_FIRST(%22LocalizedAccessStrategy%22, OBStrategy.class.getName()
 );%0A%0A

use class.getName replace package string literal