|
|
@ -27,6 +27,7 @@ public class EchoComponent extends AbstractComponent {
|
|
|
|
public static final String CONST_OPERATION_ADD_USER = "adduser";
|
|
|
|
public static final String CONST_OPERATION_ADD_USER = "adduser";
|
|
|
|
public static final String CONST_OPERATION_CHANGE_USER_PASSWORD = "chgpasswd";
|
|
|
|
public static final String CONST_OPERATION_CHANGE_USER_PASSWORD = "chgpasswd";
|
|
|
|
public static final String CONST_OPERATION_DELETE_USER = "deluser";
|
|
|
|
public static final String CONST_OPERATION_DELETE_USER = "deluser";
|
|
|
|
|
|
|
|
public static final String CONST_OPERATION_JMX_CLIENT = "jmx_client";
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
XmppComponentConfig xmppComponentConfig;
|
|
|
|
XmppComponentConfig xmppComponentConfig;
|
|
|
@ -34,6 +35,9 @@ public class EchoComponent extends AbstractComponent {
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
ReplyService replyService;
|
|
|
|
ReplyService replyService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
JmxClientService jmxClientService;
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
@Qualifier("userAdminCache")
|
|
|
|
@Qualifier("userAdminCache")
|
|
|
|
private volatile Cache<String, Message> userAdminCache;
|
|
|
|
private volatile Cache<String, Message> userAdminCache;
|
|
|
@ -93,7 +97,7 @@ public class EchoComponent extends AbstractComponent {
|
|
|
|
logger.info("[handleMessage] -- RECEIVED -- {}", inMsg);
|
|
|
|
logger.info("[handleMessage] -- RECEIVED -- {}", inMsg);
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
if (StringUtils.isNotBlank(inMsg.getBody())) {
|
|
|
|
if (StringUtils.isNotBlank(inMsg.getBody())) {
|
|
|
|
String[] commandParts = StringUtils.split(inMsg.getBody(), ' ');
|
|
|
|
String[] commandParts = StringUtils.split(inMsg.getBody().trim(), ' ');
|
|
|
|
switch (commandParts[0]) {
|
|
|
|
switch (commandParts[0]) {
|
|
|
|
case CONST_OPERATION_ADD_USER:
|
|
|
|
case CONST_OPERATION_ADD_USER:
|
|
|
|
if (commandParts.length == 3)
|
|
|
|
if (commandParts.length == 3)
|
|
|
@ -113,6 +117,9 @@ public class EchoComponent extends AbstractComponent {
|
|
|
|
else
|
|
|
|
else
|
|
|
|
doEcho(inMsg, "chgpasswd <username> <new_password>");
|
|
|
|
doEcho(inMsg, "chgpasswd <username> <new_password>");
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case CONST_OPERATION_JMX_CLIENT:
|
|
|
|
|
|
|
|
doEcho(inMsg, jmxClientService.process(commandParts));
|
|
|
|
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
doEcho(inMsg, replyService.executeShellCommand(inMsg.getBody().trim()));
|
|
|
|
doEcho(inMsg, replyService.executeShellCommand(inMsg.getBody().trim()));
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|