init
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
package com.eactive.eai.agent.property;
|
||||
|
||||
import com.eactive.eai.agent.command.Command;
|
||||
import com.eactive.eai.agent.command.CommandException;
|
||||
import com.eactive.eai.common.property.PropManager;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
|
||||
public class ReloadPropertyCommand extends Command {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public ReloadPropertyCommand() {
|
||||
super("ReloadPropertyCommand");
|
||||
}
|
||||
|
||||
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 {
|
||||
PropManager manager = PropManager.getInstance();
|
||||
|
||||
String keyName = (String) args;
|
||||
|
||||
if (keyName != null) {
|
||||
if ("ALL".equals(keyName)) {
|
||||
manager.reload();
|
||||
if (logger.isWarn())
|
||||
logger.warn(this.name + "] all rule Reload.");
|
||||
} else {
|
||||
manager.reload(keyName);
|
||||
|
||||
if (logger.isWarn())
|
||||
logger.warn(this.name + "] " + keyName + " Reload.");
|
||||
}
|
||||
}
|
||||
} 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{
|
||||
// Command command = new ReloadPropertyCommand();
|
||||
// command.setArgs("ALL");
|
||||
// AgentUtil.broadcast(command);
|
||||
//
|
||||
// }
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.eactive.eai.agent.property;
|
||||
|
||||
import com.eactive.eai.adapter.wca.util.RuntimeUtil;
|
||||
import com.eactive.eai.agent.command.Command;
|
||||
import com.eactive.eai.agent.command.CommandException;
|
||||
import com.eactive.eai.common.property.PropManager;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
|
||||
public class RemovePropertyCommand extends Command {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public RemovePropertyCommand() {
|
||||
super("RemovePropertyCommand");
|
||||
}
|
||||
|
||||
public Object execute() throws CommandException {
|
||||
Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
String SNA_PROP_GROUP_NAME = "SNAAdapter{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 {
|
||||
PropManager manager = PropManager.getInstance();
|
||||
String propertyName = null;
|
||||
|
||||
if (args != null) {
|
||||
propertyName = (String) args;
|
||||
manager.removePropGroupVO(propertyName);
|
||||
|
||||
// System.out.println("RemovePropertyCommand grpName ] "+propertyName);
|
||||
|
||||
/**
|
||||
* SNA Adapter notifyAllSoftlink
|
||||
*/
|
||||
if (SNA_PROP_GROUP_NAME.equals(propertyName)) {
|
||||
RuntimeUtil snaUtil = RuntimeUtil.getInstance();
|
||||
snaUtil.notifyAllSoftlink();
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
String rspErrorCode = "RECEAIMCM002";
|
||||
String msg = makeException(rspErrorCode, e);
|
||||
if (logger.isError())
|
||||
logger.error(msg, e);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
return "success";
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user