@Path(value="/v2/server/") public class ServerHandler extends AbstractRestDbHandler
AbstractRestDbHandler
handling all requests made on the
server commands REST entry
point.crud
Constructor and Description |
---|
ServerHandler(byte[] crud)
Instantiates the handler with the given CRUD configuration array.
|
Modifier and Type | Method and Description |
---|---|
boolean |
checkCRUD(io.netty.handler.codec.http.HttpRequest request)
Checks if the request can be made in consideration to the handler's CRUD
configuration.
|
void |
command_options(io.netty.handler.codec.http.HttpRequest request,
io.cdap.http.HttpResponder responder,
String ep)
Method called to get a list of all allowed HTTP methods on all sub entry
points of the '/server' entry
point.
|
void |
deactivate(io.netty.handler.codec.http.HttpRequest request,
io.cdap.http.HttpResponder responder)
Deactivates the server so that it doesn't accept any new transfer
request.
|
void |
getConfig(io.netty.handler.codec.http.HttpRequest request,
io.cdap.http.HttpResponder responder,
String hostStr,
String ruleStr,
String businessStr,
String aliasStr,
String roleStr)
Exports parts of the current server configuration to multiple XML files,
depending on the parameters of the
request.
|
void |
getLogs(io.netty.handler.codec.http.HttpRequest request,
io.cdap.http.HttpResponder responder,
String purgeStr,
String cleanStr,
String statusStr,
String rule,
String start,
String stop,
String startID,
String stopID,
String requester)
Export the server logs to a file.
|
void |
getStatus(io.netty.handler.codec.http.HttpRequest request,
io.cdap.http.HttpResponder responder,
String periodStr)
Get the general status of the server.
|
void |
options(io.netty.handler.codec.http.HttpRequest request,
io.cdap.http.HttpResponder responder)
Method called to get a list of all allowed HTTP methods on the '/server'
entry point.
|
void |
restart(io.netty.handler.codec.http.HttpRequest request,
io.cdap.http.HttpResponder responder)
Restart the server.
|
void |
setConfig(io.netty.handler.codec.http.HttpRequest request,
io.cdap.http.HttpResponder responder,
String purgeHostStr,
String purgeRuleStr,
String purgeBusinessStr,
String purgeAliasStr,
String purgeRoleStr,
String hostFile,
String ruleFile,
String businessFile,
String aliasFile,
String roleFile)
Imports different parts of the server configuration from the XML files
given as parameters of the request.
|
void |
shutdown_options(io.netty.handler.codec.http.HttpRequest request,
io.cdap.http.HttpResponder responder)
Method called to get a list of all allowed HTTP methods on the
'/server/shutdown' entry point.
|
void |
shutdown(io.netty.handler.codec.http.HttpRequest request,
io.cdap.http.HttpResponder responder)
Shut down the server.
|
void |
status_options(io.netty.handler.codec.http.HttpRequest request,
io.cdap.http.HttpResponder responder)
Method called to get a list of all allowed HTTP methods on the
'/server/status' entry point.
|
public ServerHandler(byte[] crud)
crud
- An array of byte containing all the REST CRUD
configurations.public boolean checkCRUD(io.netty.handler.codec.http.HttpRequest request)
checkCRUD
in class AbstractRestDbHandler
request
- the HttpRequest made to the handlertrue
if the request is valid, false
if the CRUD
configuration does not allow this
request@Path(value="status") @GET @Consumes(value="*/*") public void getStatus(io.netty.handler.codec.http.HttpRequest request, io.cdap.http.HttpResponder responder, @QueryParam(value="period") @DefaultValue(value="P1DT0H0M0S") String periodStr)
request
- the HttpRequest made on the resourceresponder
- the HttpResponder which sends the reply to the
request@Path(value="status") @OPTIONS @Consumes(value="*/*") public void status_options(io.netty.handler.codec.http.HttpRequest request, io.cdap.http.HttpResponder responder)
request
- the HttpRequest made on the resourceresponder
- the HttpResponder which sends the reply to the
request.@Path(value="deactivate") @PUT @Consumes(value="*/*") public void deactivate(io.netty.handler.codec.http.HttpRequest request, io.cdap.http.HttpResponder responder)
request
- the HttpRequest made on the resourceresponder
- the HttpResponder which sends the reply to the
request@Path(value="shutdown") @PUT @Consumes(value="*/*") public void shutdown(io.netty.handler.codec.http.HttpRequest request, io.cdap.http.HttpResponder responder)
request
- the HttpRequest made on the resourceresponder
- the HttpResponder which sends the reply to the
request@Path(value="shutdown") @OPTIONS @Consumes(value="*/*") public void shutdown_options(io.netty.handler.codec.http.HttpRequest request, io.cdap.http.HttpResponder responder)
request
- the HttpRequest made on the resourceresponder
- the HttpResponder which sends the reply to the
request.@Path(value="restart") @PUT @Consumes(value="*/*") public void restart(io.netty.handler.codec.http.HttpRequest request, io.cdap.http.HttpResponder responder)
request
- the HttpRequest made on the resourceresponder
- the HttpResponder which sends the reply to the
request@Path(value="logs") @GET @Consumes(value="application/x-www-form-urlencoded") public void getLogs(io.netty.handler.codec.http.HttpRequest request, io.cdap.http.HttpResponder responder, @QueryParam(value="purge") @DefaultValue(value="false") String purgeStr, @QueryParam(value="clean") @DefaultValue(value="false") String cleanStr, @QueryParam(value="status") @DefaultValue(value="") String statusStr, @QueryParam(value="ruleName") @DefaultValue(value="") String rule, @QueryParam(value="start") @DefaultValue(value="") String start, @QueryParam(value="stop") @DefaultValue(value="") String stop, @QueryParam(value="startID") @DefaultValue(value="") String startID, @QueryParam(value="stopID") @DefaultValue(value="") String stopID, @QueryParam(value="requester") @DefaultValue(value="") String requester)
request
- the HttpRequest made on the resourceresponder
- the HttpResponder which sends the reply to the
requestpurgeStr
- states whether to delete exported entries or notcleanStr
- states whether to fix the incoherent entriesstatusStr
- only transfers with this status will be
exportedrule
- only transfers using this rule will be exportedstart
- lower bound for the date of the transferstop
- upper bound for the date of the transferstartID
- lower bound for the transfer's IDstopID
- upper bound for the transfer's ID@Path(value="config") @GET @Consumes(value="application/x-www-form-urlencoded") public void getConfig(io.netty.handler.codec.http.HttpRequest request, io.cdap.http.HttpResponder responder, @QueryParam(value="exportHosts") @DefaultValue(value="false") String hostStr, @QueryParam(value="exportRules") @DefaultValue(value="false") String ruleStr, @QueryParam(value="exportBusiness") @DefaultValue(value="false") String businessStr, @QueryParam(value="exportAliases") @DefaultValue(value="false") String aliasStr, @QueryParam(value="exportRoles") @DefaultValue(value="false") String roleStr)
request
- the HttpRequest made on the resourceresponder
- the HttpResponder which sends the reply to the
requesthostStr
- states whether to export the host database or
not.ruleStr
- states whether to export the rules database or
not.businessStr
- states whether to export the host's business
or not.aliasStr
- states whether to export the host's aliases or
not.roleStr
- states whether to export the host's permission
database or not.@Path(value="config") @PUT @Consumes(value="application/x-www-form-urlencoded") public void setConfig(io.netty.handler.codec.http.HttpRequest request, io.cdap.http.HttpResponder responder, @QueryParam(value="purgeHosts") @DefaultValue(value="false") String purgeHostStr, @QueryParam(value="purgeRules") @DefaultValue(value="false") String purgeRuleStr, @QueryParam(value="purgeBusiness") @DefaultValue(value="false") String purgeBusinessStr, @QueryParam(value="purgeAliases") @DefaultValue(value="false") String purgeAliasStr, @QueryParam(value="purgeRoles") @DefaultValue(value="false") String purgeRoleStr, @QueryParam(value="hostsFile") @DefaultValue(value="") String hostFile, @QueryParam(value="rulesFile") @DefaultValue(value="") String ruleFile, @QueryParam(value="businessFile") @DefaultValue(value="") String businessFile, @QueryParam(value="aliasesFile") @DefaultValue(value="") String aliasFile, @QueryParam(value="rolesFile") @DefaultValue(value="") String roleFile)
request
- the HttpRequest made on the resourceresponder
- the HttpResponder which sends the reply to the
requestpurgeHostStr
- states if a new host database should be
imported.purgeRuleStr
- states if a new transfer rule database
should be importedpurgeBusinessStr
- states if a new business database should
be importedpurgeAliasStr
- states if a new alias database should be
importedpurgeRoleStr
- states if a new role database should be
importedhostFile
- path to the XML file containing the host database
to importruleFile
- path to the XML file containing the rule database
to importbusinessFile
- path to the XML file containing the business
database to importaliasFile
- path to the XML file containing the alias
database to importroleFile
- path to the XML file containing the role database
to import@OPTIONS @Consumes(value="*/*") public void options(io.netty.handler.codec.http.HttpRequest request, io.cdap.http.HttpResponder responder)
request
- the HttpRequest made on the resourceresponder
- the HttpResponder which sends the reply to the
request.@Path(value="{ep}") @OPTIONS @Consumes(value="*/*") public void command_options(io.netty.handler.codec.http.HttpRequest request, io.cdap.http.HttpResponder responder, @PathParam(value="ep") String ep)
request
- the HttpRequest made on the resourceresponder
- the HttpResponder which sends the reply to the
request.Copyright © 2009–2020 Waarp. All rights reserved.