class ConfigureDelegator extends BaseDelegator implements IConfigureDelegator {

    @Override
    public String setOrUnsetServerConfigurationValue(@Nonnull final String name,
                                                     @Nullable final String value) throws P4JavaException {

        Validate.notBlank(name, "Config name shouldn't null or empty");
        String[] args = new String[]{UNSET, name};
        if (isNotBlank(value)) {
            args = new String[]{SET, name + "=" + value};
        }

        List<Map<String, Object>> resultMaps = execMapCmdList(CONFIGURE, args, null);

        StringBuilder messageBuilder = new StringBuilder(STRING_BUILDER_SIZE);
        if (nonNull(resultMaps)) {
            for (Map<String, Object> map : resultMaps) {
                if (nonNull(map)) {
                    String str = ResultMapParser.getErrorOrInfoStr(map);
                    if (isBlank(str)) {
                        // Handling the new message format for Perforce server
                        // version 2011.1; also maintain backward compatibility.
                        if (map.containsKey(NAME_KEY)) {
                            if (map.containsKey(ACTION_KEY) && nonNull(map.get(ACTION_KEY))) {
                                String message = str;
                                String serverName = parseString(map, SERVER_NAME_KEY);
                                String configureName = parseString(map, NAME_KEY);
                                String configureValue = parseString(map, VALUE_KEY);
                                String action = parseString(map, ACTION_KEY);
                                if (SET.equalsIgnoreCase(action)) {
                                    message = format(
                                            "For server '%s', configuration variable '%s' "
                                                    + "set to '%s'",
                                            serverName, configureName, configureValue);
                                } else if (UNSET.equalsIgnoreCase(action)) {
                                    message = format(
                                            "For server '%s', configuration variable '%s' removed.",
                                            serverName, configureName);
                                }

                                if (isNotBlank(message)) {
                                    messageBuilder.append(message).append("\n");
                                }
                            }
                        }
                    } else {
                        return str;
                    }
                }
            }
        }
        return messageBuilder.toString();
    }

    public  ConfigureDelegator(final IOptionsServer server);

}