Search in sources :

Example 61 with ResponseBody

use of org.springframework.web.bind.annotation.ResponseBody in project geode by apache.

the class DataCommandsController method locateEntry.

@RequestMapping(method = RequestMethod.GET, value = "/regions/{region}/data/location")
@ResponseBody
public String locateEntry(@PathVariable("region") final String regionNamePath, @RequestParam(CliStrings.LOCATE_ENTRY__KEY) final String key, @RequestParam(value = CliStrings.LOCATE_ENTRY__KEYCLASS, required = false) final String keyClassName, @RequestParam(value = CliStrings.LOCATE_ENTRY__VALUEKLASS, required = false) final String valueClassName, @RequestParam(value = CliStrings.LOCATE_ENTRY__RECURSIVE, defaultValue = "false") final Boolean recursive) {
    final CommandStringBuilder command = new CommandStringBuilder(CliStrings.LOCATE_ENTRY);
    command.addOption(CliStrings.LOCATE_ENTRY__REGIONNAME, decode(regionNamePath));
    command.addOption(CliStrings.LOCATE_ENTRY__KEY, key);
    if (hasValue(keyClassName)) {
        command.addOption(CliStrings.LOCATE_ENTRY__KEYCLASS, keyClassName);
    }
    if (hasValue(valueClassName)) {
        command.addOption(CliStrings.LOCATE_ENTRY__VALUEKLASS, valueClassName);
    }
    command.addOption(CliStrings.LOCATE_ENTRY__RECURSIVE, String.valueOf(recursive));
    return processCommand(command.toString());
}
Also used : CommandStringBuilder(org.apache.geode.management.internal.cli.util.CommandStringBuilder) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 62 with ResponseBody

use of org.springframework.web.bind.annotation.ResponseBody in project geode by apache.

the class DataCommandsController method put.

@RequestMapping(method = RequestMethod.PUT, value = "/regions/{region}/data")
@ResponseBody
public String put(@PathVariable("region") final String regionNamePath, @RequestParam(CliStrings.PUT__KEY) final String key, @RequestParam(value = CliStrings.PUT__KEYCLASS, required = false) final String keyClassName, @RequestParam(CliStrings.PUT__VALUE) final String value, @RequestParam(value = CliStrings.PUT__VALUEKLASS, required = false) final String valueClassName, @RequestParam(value = CliStrings.PUT__PUTIFABSENT, defaultValue = "false") final Boolean putIfAbsent) {
    final CommandStringBuilder command = new CommandStringBuilder(CliStrings.PUT);
    command.addOption(CliStrings.PUT__REGIONNAME, decode(regionNamePath));
    command.addOption(CliStrings.PUT__KEY, key);
    command.addOption(CliStrings.PUT__VALUE, decode(value));
    if (hasValue(keyClassName)) {
        command.addOption(CliStrings.PUT__KEYCLASS, keyClassName);
    }
    if (hasValue(valueClassName)) {
        command.addOption(CliStrings.PUT__VALUEKLASS, valueClassName);
    }
    command.addOption(CliStrings.PUT__PUTIFABSENT, String.valueOf(putIfAbsent));
    return processCommand(command.toString());
}
Also used : CommandStringBuilder(org.apache.geode.management.internal.cli.util.CommandStringBuilder) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 63 with ResponseBody

use of org.springframework.web.bind.annotation.ResponseBody in project geode by apache.

the class DiskStoreCommandsController method createDiskStore.

@RequestMapping(method = RequestMethod.POST, value = "/diskstores")
@ResponseBody
public String createDiskStore(@RequestParam(CliStrings.CREATE_DISK_STORE__NAME) final String diskStoreNameId, @RequestParam(value = CliStrings.CREATE_DISK_STORE__DIRECTORY_AND_SIZE) final String[] directoryAndSizes, @RequestParam(value = CliStrings.CREATE_DISK_STORE__ALLOW_FORCE_COMPACTION, defaultValue = "false") final Boolean allowForceCompaction, @RequestParam(value = CliStrings.CREATE_DISK_STORE__AUTO_COMPACT, defaultValue = "true") final Boolean autoCompact, @RequestParam(value = CliStrings.CREATE_DISK_STORE__COMPACTION_THRESHOLD, defaultValue = "50") final Integer compactionThreshold, @RequestParam(value = CliStrings.CREATE_DISK_STORE__MAX_OPLOG_SIZE, defaultValue = "1024") final Integer maxOplogSize, @RequestParam(value = CliStrings.CREATE_DISK_STORE__QUEUE_SIZE, defaultValue = "0") final Integer queueSize, @RequestParam(value = CliStrings.CREATE_DISK_STORE__TIME_INTERVAL, defaultValue = "1000") final Long timeInterval, @RequestParam(value = CliStrings.CREATE_DISK_STORE__WRITE_BUFFER_SIZE, defaultValue = "32768") final Integer writeBufferSize, @RequestParam(value = CliStrings.CREATE_DISK_STORE__DISK_USAGE_WARNING_PCT, defaultValue = "90") final Float diskUsageWarningPercentage, @RequestParam(value = CliStrings.CREATE_DISK_STORE__DISK_USAGE_CRITICAL_PCT, defaultValue = "99") final Integer diskUsageCriticalPercentage, @RequestParam(value = CliStrings.CREATE_DISK_STORE__GROUP, required = false) final String[] groups) {
    CommandStringBuilder command = new CommandStringBuilder(CliStrings.CREATE_DISK_STORE);
    command.addOption(CliStrings.CREATE_DISK_STORE__NAME, diskStoreNameId);
    if (hasValue(directoryAndSizes)) {
        command.addOption(CliStrings.CREATE_DISK_STORE__DIRECTORY_AND_SIZE, StringUtils.join(directoryAndSizes, StringUtils.COMMA_DELIMITER));
    }
    command.addOption(CliStrings.CREATE_DISK_STORE__ALLOW_FORCE_COMPACTION, String.valueOf(Boolean.TRUE.equals(allowForceCompaction)));
    command.addOption(CliStrings.CREATE_DISK_STORE__AUTO_COMPACT, String.valueOf(Boolean.TRUE.equals(autoCompact)));
    command.addOption(CliStrings.CREATE_DISK_STORE__COMPACTION_THRESHOLD, String.valueOf(compactionThreshold));
    command.addOption(CliStrings.CREATE_DISK_STORE__MAX_OPLOG_SIZE, String.valueOf(maxOplogSize));
    command.addOption(CliStrings.CREATE_DISK_STORE__QUEUE_SIZE, String.valueOf(queueSize));
    command.addOption(CliStrings.CREATE_DISK_STORE__TIME_INTERVAL, String.valueOf(timeInterval));
    command.addOption(CliStrings.CREATE_DISK_STORE__WRITE_BUFFER_SIZE, String.valueOf(writeBufferSize));
    command.addOption(CliStrings.CREATE_DISK_STORE__DISK_USAGE_WARNING_PCT, String.valueOf(diskUsageWarningPercentage));
    command.addOption(CliStrings.CREATE_DISK_STORE__DISK_USAGE_CRITICAL_PCT, String.valueOf(diskUsageCriticalPercentage));
    if (hasValue(groups)) {
        command.addOption(CliStrings.CREATE_DISK_STORE__GROUP, StringUtils.join(groups, StringUtils.COMMA_DELIMITER));
    }
    return processCommand(command.toString());
}
Also used : CommandStringBuilder(org.apache.geode.management.internal.cli.util.CommandStringBuilder) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 64 with ResponseBody

use of org.springframework.web.bind.annotation.ResponseBody in project geode by apache.

the class DiskStoreCommandsController method destroyDiskStore.

// TODO determine whether Async functionality is required
@RequestMapping(method = RequestMethod.DELETE, value = "/diskstores/{name}")
@ResponseBody
public String destroyDiskStore(@PathVariable("name") final String diskStoreNameId, @RequestParam(value = CliStrings.DESTROY_DISK_STORE__GROUP, required = false) final String[] groups) {
    CommandStringBuilder command = new CommandStringBuilder(CliStrings.DESTROY_DISK_STORE);
    command.addOption(CliStrings.DESTROY_DISK_STORE__NAME, decode(diskStoreNameId));
    if (hasValue(groups)) {
        command.addOption(CliStrings.DESTROY_DISK_STORE__GROUP, StringUtils.join(groups, StringUtils.COMMA_DELIMITER));
    }
    return processCommand(command.toString());
}
Also used : CommandStringBuilder(org.apache.geode.management.internal.cli.util.CommandStringBuilder) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 65 with ResponseBody

use of org.springframework.web.bind.annotation.ResponseBody in project geode by apache.

the class ConfigCommandsController method describeConfig.

@RequestMapping(method = RequestMethod.GET, value = "/members/{member}/config")
@ResponseBody
public String describeConfig(@PathVariable("member") final String memberNameId, @RequestParam(value = CliStrings.DESCRIBE_CONFIG__HIDE__DEFAULTS, defaultValue = "true") final Boolean hideDefaults) {
    CommandStringBuilder command = new CommandStringBuilder(CliStrings.DESCRIBE_CONFIG);
    command.addOption(CliStrings.DESCRIBE_CONFIG__MEMBER, decode(memberNameId));
    command.addOption(CliStrings.DESCRIBE_CONFIG__HIDE__DEFAULTS, String.valueOf(hideDefaults));
    return processCommand(command.toString());
}
Also used : CommandStringBuilder(org.apache.geode.management.internal.cli.util.CommandStringBuilder) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Aggregations

ResponseBody (org.springframework.web.bind.annotation.ResponseBody)1991 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1700 HashMap (java.util.HashMap)458 PreAuthorize (org.springframework.security.access.prepost.PreAuthorize)212 IOException (java.io.IOException)207 JSONObject (com.alibaba.fastjson.JSONObject)200 Map (java.util.Map)172 ApiOperation (io.swagger.annotations.ApiOperation)170 ArrayList (java.util.ArrayList)169 GetMapping (org.springframework.web.bind.annotation.GetMapping)112 ResponseEntity (org.springframework.http.ResponseEntity)102 ApiRest (build.dream.common.api.ApiRest)101 ResultCodeException (eu.bcvsolutions.idm.core.api.exception.ResultCodeException)101 AuthPassport (com.ngtesting.platform.util.AuthPassport)99 PostMapping (org.springframework.web.bind.annotation.PostMapping)94 ResponseStatus (org.springframework.web.bind.annotation.ResponseStatus)87 Date (java.util.Date)81 UserVo (com.ngtesting.platform.vo.UserVo)78 LogDetail (com.bc.pmpheep.annotation.LogDetail)71 ResponseBean (com.bc.pmpheep.controller.bean.ResponseBean)65