79 lines
2.2 KiB
Java
79 lines
2.2 KiB
Java
package com.eactive.eai.agent.routing;
|
|
|
|
import com.eactive.eai.agent.command.Command;
|
|
import com.eactive.eai.agent.command.CommandException;
|
|
import com.eactive.eai.common.routing.RoutingManager;
|
|
import com.eactive.eai.common.util.Logger;
|
|
|
|
public class RemoveRoutingCommand extends Command {
|
|
|
|
private static final long serialVersionUID = 1L;
|
|
|
|
public RemoveRoutingCommand() {
|
|
super("RemoveRoutingCommand");
|
|
}
|
|
|
|
public Object execute() throws CommandException {
|
|
Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
|
if (logger.isInfo())
|
|
logger.info(this.name + " is executed");
|
|
|
|
if (!(args instanceof String)) {
|
|
String rspErrorCode = "RECEAIMCM001";
|
|
String msg = makeException(rspErrorCode, null);
|
|
if (logger.isError())
|
|
logger.error(msg);
|
|
throw new CommandException(msg);
|
|
}
|
|
|
|
try {
|
|
RoutingManager manager = RoutingManager.getInstance();
|
|
String key = null;
|
|
|
|
key = (String) args;
|
|
if (key != null) {
|
|
manager.removeRoutingVO(key);
|
|
}
|
|
} catch (Exception e) {
|
|
String rspErrorCode = "RECEAIMCM002";
|
|
String msg = makeException(rspErrorCode, e);
|
|
if (logger.isError())
|
|
logger.error(msg, e);
|
|
throw new CommandException(msg);
|
|
}
|
|
return "success";
|
|
|
|
}
|
|
|
|
// public static void main(String args[]) throws Exception {
|
|
// test(String args[]);
|
|
//}
|
|
|
|
//private static void test(String args[]) throws Exception {
|
|
// String selectedName = null;
|
|
//// String updateData = null;
|
|
//
|
|
// if(args.length ==1)
|
|
// selectedName = args[0];
|
|
//
|
|
// if(selectedName == null || selectedName.length() ==0){
|
|
// selectedName = "ALL_TEST";
|
|
// }
|
|
//
|
|
// RoutingManager manager = RoutingManager.getInstance();
|
|
// RoutingVO vo = new RoutingVO();
|
|
// vo.setName(selectedName);
|
|
//
|
|
// if(vo != null){
|
|
// System.out.println("RemoveRoutingCommand ] vo is not null.... remove start");
|
|
//
|
|
// Command command = new RemoveRoutingCommand();
|
|
// command.setArgs(vo);
|
|
// AgentUtil.broadcast(command);
|
|
// }
|
|
// else{
|
|
// System.out.println("RemoveRoutingCommand ] main() vo is null");
|
|
// }
|
|
// }
|
|
}
|