|
@ -16,12 +16,13 @@ |
|
|
*/ |
|
|
*/ |
|
|
package org.apache.rocketmq.dashboard.controller; |
|
|
package org.apache.rocketmq.dashboard.controller; |
|
|
|
|
|
|
|
|
import org.apache.rocketmq.dashboard.permisssion.Permission; |
|
|
|
|
|
import org.apache.rocketmq.dashboard.service.ConfigService; |
|
|
import org.apache.rocketmq.dashboard.service.ConfigService; |
|
|
import org.slf4j.Logger; |
|
|
import org.slf4j.Logger; |
|
|
import org.slf4j.LoggerFactory; |
|
|
import org.slf4j.LoggerFactory; |
|
|
import org.springframework.stereotype.Controller; |
|
|
import org.springframework.stereotype.Controller; |
|
|
import org.springframework.web.bind.annotation.*; |
|
|
import org.springframework.web.bind.annotation.RequestMapping; |
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestParam; |
|
|
|
|
|
import org.springframework.web.bind.annotation.ResponseBody; |
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
import javax.annotation.Resource; |
|
|
import java.util.Map; |
|
|
import java.util.Map; |
|
@ -43,20 +44,35 @@ public class ConfigController { |
|
|
|
|
|
|
|
|
@RequestMapping(value = "/config.create") |
|
|
@RequestMapping(value = "/config.create") |
|
|
@ResponseBody |
|
|
@ResponseBody |
|
|
public boolean create(String name, String value) { |
|
|
public boolean create(@RequestParam String name, @RequestParam String value) { |
|
|
|
|
|
if(name == null || name.isEmpty()) { |
|
|
|
|
|
throw new RuntimeException("name is empty!"); |
|
|
|
|
|
} |
|
|
|
|
|
if(value == null || value.isEmpty()) { |
|
|
|
|
|
throw new RuntimeException("value is empty!"); |
|
|
|
|
|
} |
|
|
return configService.createConfig(name, value); |
|
|
return configService.createConfig(name, value); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@RequestMapping(value = "/config.update") |
|
|
@RequestMapping(value = "/config.update") |
|
|
@ResponseBody |
|
|
@ResponseBody |
|
|
public boolean update(String name, String value) { |
|
|
public boolean update(@RequestParam String name, @RequestParam String value) { |
|
|
|
|
|
if(name == null || name.isEmpty()) { |
|
|
|
|
|
throw new RuntimeException("name is empty!"); |
|
|
|
|
|
} |
|
|
|
|
|
if(value == null || value.isEmpty()) { |
|
|
|
|
|
throw new RuntimeException("value is empty!"); |
|
|
|
|
|
} |
|
|
return configService.updateConfig(name, value); |
|
|
return configService.updateConfig(name, value); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@RequestMapping(value = "/config.delete") |
|
|
@RequestMapping(value = "/config.delete") |
|
|
@ResponseBody |
|
|
@ResponseBody |
|
|
public boolean delete(String name, String value) { |
|
|
public boolean delete(@RequestParam String name) { |
|
|
return configService.deleteConfig(name, value); |
|
|
if(name == null || name.isEmpty()) { |
|
|
|
|
|
throw new RuntimeException("name is empty!"); |
|
|
|
|
|
} |
|
|
|
|
|
return configService.deleteConfig(name); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|