Loading sharding-core/src/main/java/io/shardingsphere/core/constant/ShardingProperties.java→sharding-core/src/main/java/io/shardingsphere/core/constant/properties/ShardingProperties.java +1 −1 Original line number Diff line number Diff line Loading @@ -15,7 +15,7 @@ * </p> */ package io.shardingsphere.core.constant; package io.shardingsphere.core.constant.properties; import com.google.common.base.Joiner; import com.google.common.base.Strings; Loading sharding-core/src/main/java/io/shardingsphere/core/constant/ShardingPropertiesConstant.java→sharding-core/src/main/java/io/shardingsphere/core/constant/properties/ShardingPropertiesConstant.java +3 −1 Original line number Diff line number Diff line Loading @@ -15,8 +15,10 @@ * </p> */ package io.shardingsphere.core.constant; package io.shardingsphere.core.constant.properties; import io.shardingsphere.core.constant.ConnectionMode; import io.shardingsphere.core.constant.transaction.TransactionType; import lombok.Getter; import lombok.RequiredArgsConstructor; Loading sharding-transaction/src/main/java/io/shardingsphere/transaction/common/event/TransactionEvent.java→sharding-core/src/main/java/io/shardingsphere/core/constant/transaction/TransactionOperationType.java +52 −0 Original line number Diff line number Diff line Loading @@ -15,39 +15,38 @@ * </p> */ package io.shardingsphere.transaction.common.event; package io.shardingsphere.core.constant.transaction; import com.google.common.base.Optional; import io.shardingsphere.core.constant.TCLType; import lombok.Getter; import lombok.RequiredArgsConstructor; import lombok.Setter; import java.util.UUID; /** * Abstract Transaction Event. * Transaction operation type. * * @author zhaojun */ @RequiredArgsConstructor @Getter public abstract class TransactionEvent { private final String id = UUID.randomUUID().toString(); public enum TransactionOperationType { private final TCLType tclType; @Setter private Exception exception; BEGIN, COMMIT, ROLLBACK; /** * Get exception. * Get operation type. * * @return exception * @param sql SQL * @return transaction operation type */ // TODO why not use sharding exception directly? public Optional<? extends Exception> getException() { return Optional.fromNullable(exception); // TODO :hongjun move to TCLParser, need parse comment etc public static Optional<TransactionOperationType> getOperationType(final String sql) { switch (sql.toUpperCase()) { case "BEGIN": case "START TRANSACTION": case "SET AUTOCOMMIT=0": return Optional.of(TransactionOperationType.BEGIN); case "COMMIT": return Optional.of(TransactionOperationType.COMMIT); case "ROLLBACK": return Optional.of(TransactionOperationType.ROLLBACK); default: return Optional.absent(); } } } sharding-core/src/main/java/io/shardingsphere/core/constant/TransactionType.java→sharding-core/src/main/java/io/shardingsphere/core/constant/transaction/TransactionType.java +1 −1 Original line number Diff line number Diff line Loading @@ -15,7 +15,7 @@ * </p> */ package io.shardingsphere.core.constant; package io.shardingsphere.core.constant.transaction; /** * Transaction type. Loading sharding-core/src/test/java/io/shardingsphere/core/constant/ShardingPropertiesConstantTest.java +1 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package io.shardingsphere.core.constant; import io.shardingsphere.core.constant.properties.ShardingPropertiesConstant; import org.junit.Test; import static org.hamcrest.CoreMatchers.is; Loading Loading
sharding-core/src/main/java/io/shardingsphere/core/constant/ShardingProperties.java→sharding-core/src/main/java/io/shardingsphere/core/constant/properties/ShardingProperties.java +1 −1 Original line number Diff line number Diff line Loading @@ -15,7 +15,7 @@ * </p> */ package io.shardingsphere.core.constant; package io.shardingsphere.core.constant.properties; import com.google.common.base.Joiner; import com.google.common.base.Strings; Loading
sharding-core/src/main/java/io/shardingsphere/core/constant/ShardingPropertiesConstant.java→sharding-core/src/main/java/io/shardingsphere/core/constant/properties/ShardingPropertiesConstant.java +3 −1 Original line number Diff line number Diff line Loading @@ -15,8 +15,10 @@ * </p> */ package io.shardingsphere.core.constant; package io.shardingsphere.core.constant.properties; import io.shardingsphere.core.constant.ConnectionMode; import io.shardingsphere.core.constant.transaction.TransactionType; import lombok.Getter; import lombok.RequiredArgsConstructor; Loading
sharding-transaction/src/main/java/io/shardingsphere/transaction/common/event/TransactionEvent.java→sharding-core/src/main/java/io/shardingsphere/core/constant/transaction/TransactionOperationType.java +52 −0 Original line number Diff line number Diff line Loading @@ -15,39 +15,38 @@ * </p> */ package io.shardingsphere.transaction.common.event; package io.shardingsphere.core.constant.transaction; import com.google.common.base.Optional; import io.shardingsphere.core.constant.TCLType; import lombok.Getter; import lombok.RequiredArgsConstructor; import lombok.Setter; import java.util.UUID; /** * Abstract Transaction Event. * Transaction operation type. * * @author zhaojun */ @RequiredArgsConstructor @Getter public abstract class TransactionEvent { private final String id = UUID.randomUUID().toString(); public enum TransactionOperationType { private final TCLType tclType; @Setter private Exception exception; BEGIN, COMMIT, ROLLBACK; /** * Get exception. * Get operation type. * * @return exception * @param sql SQL * @return transaction operation type */ // TODO why not use sharding exception directly? public Optional<? extends Exception> getException() { return Optional.fromNullable(exception); // TODO :hongjun move to TCLParser, need parse comment etc public static Optional<TransactionOperationType> getOperationType(final String sql) { switch (sql.toUpperCase()) { case "BEGIN": case "START TRANSACTION": case "SET AUTOCOMMIT=0": return Optional.of(TransactionOperationType.BEGIN); case "COMMIT": return Optional.of(TransactionOperationType.COMMIT); case "ROLLBACK": return Optional.of(TransactionOperationType.ROLLBACK); default: return Optional.absent(); } } }
sharding-core/src/main/java/io/shardingsphere/core/constant/TransactionType.java→sharding-core/src/main/java/io/shardingsphere/core/constant/transaction/TransactionType.java +1 −1 Original line number Diff line number Diff line Loading @@ -15,7 +15,7 @@ * </p> */ package io.shardingsphere.core.constant; package io.shardingsphere.core.constant.transaction; /** * Transaction type. Loading
sharding-core/src/test/java/io/shardingsphere/core/constant/ShardingPropertiesConstantTest.java +1 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package io.shardingsphere.core.constant; import io.shardingsphere.core.constant.properties.ShardingPropertiesConstant; import org.junit.Test; import static org.hamcrest.CoreMatchers.is; Loading