<commit_before>package io.cloudslang.content.rft.spike_rft;

import com.hp.oo.sdk.content.annotations.Action;
import com.hp.oo.sdk.content.annotations.Output;
import com.hp.oo.sdk.content.annotations.Param;
import com.hp.oo.sdk.content.annotations.Response;
import io.cloudslang.content.constants.ReturnCodes;

import java.util.Map;

import static com.hp.oo.sdk.content.plugin.ActionMetadata.MatchType.COMPARE_EQUAL;
import static com.hp.oo.sdk.content.plugin.ActionMetadata.ResponseType.ERROR;
import static com.hp.oo.sdk.content.plugin.ActionMetadata.ResponseType.RESOLVED;
import static io.cloudslang.content.constants.OutputNames.*;
import static io.cloudslang.content.constants.ResponseNames.FAILURE;
import static io.cloudslang.content.constants.ResponseNames.SUCCESS;
import static io.cloudslang.content.rft.spike_rft.Constants.*;
import static io.cloudslang.content.rft.spike_rft.InputsValidation.*;
import static io.cloudslang.content.rft.utils.Descriptions.FTPDescriptions.*;


public class RemoteCopyAction {

    @Action(name = "Remote Copy Action",
            outputs = {
                    @Output(value = RETURN_RESULT, description = RETURN_RESULT_DESC),
                    @Output(value = RETURN_CODE, description = RETURN_CODE_DESC),
                    @Output(value = EXCEPTION, description = EXCEPTION_DESC),
            },
            responses = {
                    @Response(text = SUCCESS, field = RETURN_CODE, value = ReturnCodes.SUCCESS, matchType = COMPARE_EQUAL, responseType = RESOLVED, description = SUCCESS_DESC),
                    @Response(text = FAILURE, field = RETURN_CODE, value = ReturnCodes.FAILURE, matchType = COMPARE_EQUAL, responseType = ERROR, description = FAILURE_DESC)
            })
    public Map<String, String> execute(@Param(value = INPUT_SRC_HOST, description = PARAM_HOSTNAME_DESC) String sourceHost,
                                       @Param(value = INPUT_SRC_PORT, description = PARAM_PORT_DESC) String sourcePort,
                                       @Param(value = INPUT_SRC_USERNAME, description = PARAM_LOCAL_FILE_DESC) String sourceUsername,
                                       @Param(value = INPUT_SRC_PASSWORD, description = PARAM_REMOTE_FILE_DESC) String sourcePassword,
                                       @Param(value = INPUT_SRC_PRIVATE_KEY_FILE, description = PARAM_USER_DESC) String sourcePrivateKeyFile,
                                       @Param(value = INPUT_SRC_PATH, description = PARAM_PASSWORD_DESC) String sourcePath,
                                       @Param(value = INPUT_SRC_PROTOCOL, description = PARAM_TYPE_DESC) String sourceProtocol,
                                       @Param(value = INPUT_SRC_TIMEOUT, description = PARAM_PASSIVE_DESC) String sourceTimeout,
                                       @Param(value = INPUT_SRC_CHARACTER_SET, description = PARAM_CHARACTER_SET_DESC) String sourceCharacterSet,
                                       @Param(value = INPUT_DEST_HOST, description = PARAM_HOSTNAME_DESC) String destinationHost,
                                       @Param(value = INPUT_DEST_PORT, description = PARAM_PORT_DESC) String destinationPort,
                                       @Param(value = INPUT_DEST_USERNAME, description = PARAM_LOCAL_FILE_DESC) String destinationUsername,
                                       @Param(value = INPUT_DEST_PASSWORD, description = PARAM_REMOTE_FILE_DESC) String destinationPassword,
                                       @Param(value = INPUT_DEST_PRIVATE_KEY_FILE, description = PARAM_USER_DESC) String destinationPrivateKeyFile,
                                       @Param(value = INPUT_DEST_PATH, description = PARAM_PASSWORD_DESC) String destinationPath,
                                       @Param(value = INPUT_DEST_PROTOCOL, description = PARAM_TYPE_DESC) String destinationProtocol,
                                       @Param(value = INPUT_DEST_TIMEOUT, description = PARAM_PASSIVE_DESC) String destinationTimeout,
                                       @Param(value = INPUT_DEST_CHARACTERSET, description = PARAM_CHARACTER_SET_DESC) String destinationCharacterSet,
                                       @Param(value = INPUT_FILE_TYPE, description = PARAM_CHARACTER_SET_DESC) String fileType,
                                       @Param(value = INPUT_PASSIVE, description = PARAM_CHARACTER_SET_DESC) String passive) {

        Map<String, String> result = null;

        validateProtocol(srcProtocol);
        validateProtocol(destProtocol);
        ICopier src = CopierFactory.getExecutor(srcProtocol);
        src.setProtocol(srcProtocol);
        ICopier dest = CopierFactory.getExecutor(destProtocol);
        dest.setProtocol(destProtocol);

        io.cloudslang.content.rft.spike_rft.InputsValidation.checkOptions(srcProtocol, srcHost, type);
        checkOptions(destProtocol, destHost, type);

        setCredentials(src, srcHost, srcPort, srcUsername, srcPassword, srcPrivateKeyFile);
        setCredentials(dest, destHost, destPort, destUsername, destPassword, destPrivateKeyFile);

        setAndValidateCharacterSet(src, srcCharacterSet, INPUT_SRC_CHARACTER_SET);
        setAndValidateCharacterSet(dest, destCharacterSet, INPUT_DEST_CHARACTERSET);

        setCustomArgumentForFTP(src, dest, srcProtocol, destProtocol, type, passive);

        setTimeout(src, srcTimeout);
        setTimeout(dest, destTimeout);

        src.copyTo(dest, srcPath, destPath);
        result.put("returnResult", "Copy completed successfully");<commit_msg>changed inputs names<commit_after>package io.cloudslang.content.rft.spike_rft;

import com.hp.oo.sdk.content.annotations.Action;
import com.hp.oo.sdk.content.annotations.Output;
import com.hp.oo.sdk.content.annotations.Param;
import com.hp.oo.sdk.content.annotations.Response;
import io.cloudslang.content.constants.ReturnCodes;

import java.util.Map;

import static com.hp.oo.sdk.content.plugin.ActionMetadata.MatchType.COMPARE_EQUAL;
import static com.hp.oo.sdk.content.plugin.ActionMetadata.ResponseType.ERROR;
import static com.hp.oo.sdk.content.plugin.ActionMetadata.ResponseType.RESOLVED;
import static io.cloudslang.content.constants.OutputNames.*;
import static io.cloudslang.content.constants.ResponseNames.FAILURE;
import static io.cloudslang.content.constants.ResponseNames.SUCCESS;
import static io.cloudslang.content.rft.spike_rft.Constants.*;
import static io.cloudslang.content.rft.spike_rft.InputsValidation.*;
import static io.cloudslang.content.rft.utils.Descriptions.FTPDescriptions.*;

public class RemoteCopyAction {

    @Action(name = "Remote Copy Action",
            outputs = {
                    @Output(value = RETURN_RESULT, description = RETURN_RESULT_DESC),
                    @Output(value = RETURN_CODE, description = RETURN_CODE_DESC),
                    @Output(value = EXCEPTION, description = EXCEPTION_DESC),
            },
            responses = {
                    @Response(text = SUCCESS, field = RETURN_CODE, value = ReturnCodes.SUCCESS, matchType = COMPARE_EQUAL, responseType = RESOLVED, description = SUCCESS_DESC),
                    @Response(text = FAILURE, field = RETURN_CODE, value = ReturnCodes.FAILURE, matchType = COMPARE_EQUAL, responseType = ERROR, description = FAILURE_DESC)
            })
    public Map<String, String> execute(@Param(value = INPUT_SRC_HOST, description = PARAM_HOSTNAME_DESC) String sourceHost,
                                       @Param(value = INPUT_SRC_PORT, description = PARAM_PORT_DESC) String sourcePort,
                                       @Param(value = INPUT_SRC_USERNAME, description = PARAM_LOCAL_FILE_DESC) String sourceUsername,
                                       @Param(value = INPUT_SRC_PASSWORD, description = PARAM_REMOTE_FILE_DESC) String sourcePassword,
                                       @Param(value = INPUT_SRC_PRIVATE_KEY_FILE, description = PARAM_USER_DESC) String sourcePrivateKeyFile,
                                       @Param(value = INPUT_SRC_PATH, description = PARAM_PASSWORD_DESC) String sourcePath,
                                       @Param(value = INPUT_SRC_PROTOCOL, description = PARAM_TYPE_DESC) String sourceProtocol,
                                       @Param(value = INPUT_SRC_TIMEOUT, description = PARAM_PASSIVE_DESC) String sourceTimeout,
                                       @Param(value = INPUT_SRC_CHARACTER_SET, description = PARAM_CHARACTER_SET_DESC) String sourceCharacterSet,
                                       @Param(value = INPUT_DEST_HOST, description = PARAM_HOSTNAME_DESC) String destinationHost,
                                       @Param(value = INPUT_DEST_PORT, description = PARAM_PORT_DESC) String destinationPort,
                                       @Param(value = INPUT_DEST_USERNAME, description = PARAM_LOCAL_FILE_DESC) String destinationUsername,
                                       @Param(value = INPUT_DEST_PASSWORD, description = PARAM_REMOTE_FILE_DESC) String destinationPassword,
                                       @Param(value = INPUT_DEST_PRIVATE_KEY_FILE, description = PARAM_USER_DESC) String destinationPrivateKeyFile,
                                       @Param(value = INPUT_DEST_PATH, description = PARAM_PASSWORD_DESC) String destinationPath,
                                       @Param(value = INPUT_DEST_PROTOCOL, description = PARAM_TYPE_DESC) String destinationProtocol,
                                       @Param(value = INPUT_DEST_TIMEOUT, description = PARAM_PASSIVE_DESC) String destinationTimeout,
                                       @Param(value = INPUT_DEST_CHARACTERSET, description = PARAM_CHARACTER_SET_DESC) String destinationCharacterSet,
                                       @Param(value = INPUT_FILE_TYPE, description = PARAM_CHARACTER_SET_DESC) String fileType,
                                       @Param(value = INPUT_PASSIVE, description = PARAM_CHARACTER_SET_DESC) String passive) throws Exception {

        Map<String, String> result = null;

        validateProtocol(sourceProtocol);
        validateProtocol(destinationProtocol);
        ICopier src = CopierFactory.getExecutor(sourceProtocol);
        src.setProtocol(sourceProtocol);
        ICopier dest = CopierFactory.getExecutor(destinationProtocol);
        dest.setProtocol(destinationProtocol);

        io.cloudslang.content.rft.spike_rft.InputsValidation.checkOptions(sourceProtocol, sourceHost, fileType);
        checkOptions(destinationProtocol, destinationHost, fileType);

        setCredentials(src, sourceHost, sourceProtocol, sourceUsername, sourcePassword, sourcePrivateKeyFile);
        setCredentials(dest, destinationHost, destinationPort, destinationUsername, destinationPassword, destinationPrivateKeyFile);

        setAndValidateCharacterSet(src, sourceCharacterSet, INPUT_SRC_CHARACTER_SET);
        setAndValidateCharacterSet(dest, destinationCharacterSet, INPUT_DEST_CHARACTERSET);

        setCustomArgumentForFTP(src, dest, sourceProtocol, destinationProtocol, fileType, Boolean.parseBoolean(passive));

        setTimeout(src, sourceTimeout);
        setTimeout(dest, destinationTimeout);

        src.copyTo(dest, sourcePath, destinationPath);
        result.put("returnResult", "Copy completed successfully");
{'fraction_non_alphanumeric': 0.07629596809924678, 'fraction_numerical': 0.0, 'mean_word_length': 2.7707985299031073, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 38, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5109998', 'n_tokens_mistral': 2953, 'n_tokens_neox': 2921, 'n_words': 531}