private ConfigOverlay applyRequestHandler(CommandOperation op, ConfigOverlay overlay) { String name = op.getStr(NAME); op.getStr(CLASS_NAME); op.getMap(PluginInfo.DEFAULTS, null); op.getMap(PluginInfo.INVARIANTS, null); op.getMap(PluginInfo.APPENDS, null); if (op.hasError()) return overlay; if (CREATE_REQHANDLER.equals(op.name)) { if (overlay.getReqHandlers().containsKey(name)) { op.addError( MessageFormat.format( " ''{0}'' already exists . Do an ''{1}'' , if you want to change it ", name, UPDATE_REQHANDLER)); return overlay; } else { return overlay.addReqHandler(op.getDataMap()); } } else if (UPDATE_REQHANDLER.equals(op.name)) { if (!overlay.getReqHandlers().containsKey(name)) { op.addError( MessageFormat.format( " ''{0}'' does not exist . Do an ''{1}'' , if you want to create it ", name, CREATE_REQHANDLER)); return overlay; } else { return overlay.addReqHandler(op.getDataMap()); } } return overlay; }
private ConfigOverlay applyDeleteHandler(CommandOperation op, ConfigOverlay overlay) { String name = op.getStr(CommandOperation.ROOT_OBJ); if (op.hasError()) return overlay; if (overlay.getReqHandlers().containsKey(name)) { return overlay.deleteHandler(name); } else { op.addError(MessageFormat.format("NO such requestHandler ''{0}'' ", name)); return overlay; } }