/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You 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.apache.shardingsphere.api.config;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.util.Properties;

/**
 * Encryptor configuration.
 *
 * @author panjuan
 */
@NoArgsConstructor
@AllArgsConstructor
@Getter
@Setter
public final class EncryptorConfiguration {
    
    private String type;
    
    private String columns;
    
    private String assistedQueryColumns;
    
    private Properties props = new Properties();
}

@@ -843,16 +843,95 @@
 onfig;%0A%0A
+import com.google.common.base.Splitter;%0Aimport com.google.common.base.Strings;%0A
 import l
@@ -1032,16 +1032,245 @@
 .Setter;
+%0Aimport org.apache.shardingsphere.core.encrypt.ShardingEncryptorFactory;%0Aimport org.apache.shardingsphere.core.encrypt.encryptor.ShardingEncryptor;%0Aimport org.apache.shardingsphere.core.routing.strategy.ShardingEncryptorStrategy;
 %0A%0Aimport
@@ -1613,10 +1613,985 @@
 ties();%0A
+    %0A    /**%0A     * Get sharding encryptor strategy.%0A     *%0A     * @return sharding encryptor strategy%0A     */%0A    public ShardingEncryptorStrategy getShardingEncryptorStrategy() %7B%0A        if (Strings.isNullOrEmpty(type) %7C%7C Strings.isNullOrEmpty(columns)) %7B%0A            return null;%0A        %7D%0A        ShardingEncryptor shardingEncryptor = ShardingEncryptorFactory.newInstance(type);%0A        shardingEncryptor.setProperties(props);%0A        return getShardingEncryptorStrategy(shardingEncryptor);%0A    %7D%0A    %0A    private ShardingEncryptorStrategy getShardingEncryptorStrategy(final ShardingEncryptor shardingEncryptor) %7B%0A        return Strings.isNullOrEmpty(assistedQueryColumns) ? new ShardingEncryptorStrategy(Splitter.on(%22,%22).trimResults().splitToList(columns), shardingEncryptor) %0A                : new ShardingEncryptorStrategy(Splitter.on(%22,%22).trimResults().splitToList(columns), Splitter.on(%22,%22).trimResults().splitToList(assistedQueryColumns), shardingEncryptor);%0A    %7D%0A
 %7D%0A

add getShardingEncryptorStrategy()