package Ġnl . code centric . ax on . open admin . command Ċ Ċ import Ġnl . code centric . ax on . open admin . metrics . Token Status Service Ċ import Ġorg . slf 4 j . LoggerFactory Ċ import Ġorg . springframework . http . Response Entity Ċ import Ġorg . springframework . web . bind . annotation . PostMapping Ċ import Ġorg . springframework . web . bind . annotation . RequestBody Ċ import Ġorg . springframework . web . bind . annotation . RequestMapping Ċ import Ġorg . springframework . web . bind . annotation . RestController Ċ Ċ @ RestController Ċ @ RequestMapping ("\ ${ ax on . admin . base - url : ax on - admin }") Ċ class ĠAx on Open Admin Command Endpoint ( ĊĠĠĠĠĠĠĠ Ġprivate Ġval Ġtoken Status Service : ĠToken Status Service , ĊĠĠĠĠĠĠĠ Ġprivate Ġval Ġhandlers : ĠList < Ax on Admin CommandHandler > Ċ ) Ġ{ ĊĠĠĠ Ġprivate Ġval Ġlogger Ġ= ĠLoggerFactory . getLogger ( this :: class . java ) ĊĊĠĠĠ Ġ@ PostMapping ("/ command ") ĊĠĠĠ Ġfun Ġexecute Command (@ RequestBody Ġcommand : ĠAx on Admin Command ): ĠResponseEntity < Unit > Ġ{ ĊĠĠĠĠĠĠĠ Ġif Ġ( command . nodeId Ġ!= Ġnull Ġ&& Ġcommand . nodeId Ġ!= Ġtoken Status Service . getNode Id ()) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġreturn ĠResponseEntity . no Content (). build () ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġlogger . info (" Executing Ġcommand Ġfor ĠAx on ĠAdmin : Ġ{}", Ġcommand ) ĊĠĠĠĠĠĠĠ Ġval Ġax on Admin CommandHandler Ġ= Ġhandlers . first OrNull Ġ{ Ġit . command Type Ġ== Ġcommand . type Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ?: Ġthrow ĠIllegalArgumentException (" No Ġknown Ġhandler Ġfor Ġcommand Ġtype Ġ${ command . type }") ĊĠĠĠĠĠĠĠ Ġax on Admin CommandHandler . execute Command ( command ) ĊĊĠĠĠĠĠĠĠ Ġreturn ĠResponseEntity . ok (). build () ĊĠĠĠ Ġ} Ċ } Ċ