use of co.cask.cdap.common.internal.remote.MethodArgument in project cdap by caskdata.
the class AbstractRemoteSystemOpsHandler method deserializeNext.
@Nullable
<T> T deserializeNext(Iterator<MethodArgument> arguments, @Nullable Type typeOfT) throws ClassNotFoundException, BadRequestException {
if (!arguments.hasNext()) {
throw new BadRequestException("Expected additional elements.");
}
MethodArgument argument = arguments.next();
if (argument == null) {
return null;
}
JsonElement value = argument.getValue();
if (value == null) {
return null;
}
if (typeOfT != null) {
return GSON.fromJson(value, typeOfT);
}
return GSON.<T>fromJson(value, Class.forName(argument.getType()));
}
use of co.cask.cdap.common.internal.remote.MethodArgument in project cdap by caskdata.
the class RemotePrivilegesHandler method listPrivileges.
@POST
@Path("/listPrivileges")
public void listPrivileges(FullHttpRequest request, HttpResponder responder) throws Exception {
Iterator<MethodArgument> arguments = parseArguments(request);
Principal principal = deserializeNext(arguments);
LOG.trace("Listing privileges for principal {}", principal);
Set<Privilege> privileges = privilegesManager.listPrivileges(principal);
LOG.debug("Returning privileges for principal {} as {}", principal, privileges);
responder.sendJson(HttpResponseStatus.OK, GSON.toJson(privileges));
}
use of co.cask.cdap.common.internal.remote.MethodArgument in project cdap by caskdata.
the class RemoteRuntimeStoreHandler method updateWorkflowToken.
@POST
@Path("/updateWorkflowToken")
public void updateWorkflowToken(FullHttpRequest request, HttpResponder responder) throws Exception {
Iterator<MethodArgument> arguments = parseArguments(request);
ProgramRunId workflowRunId = deserializeNext(arguments);
WorkflowToken token = deserializeNext(arguments);
store.updateWorkflowToken(workflowRunId, token);
responder.sendStatus(HttpResponseStatus.OK);
}
use of co.cask.cdap.common.internal.remote.MethodArgument in project cdap by caskdata.
the class RemoteUsageRegistryHandler method registerDataset.
@POST
@Path("/registerDataset")
public void registerDataset(FullHttpRequest request, HttpResponder responder) throws Exception {
Iterator<MethodArgument> arguments = parseArguments(request);
ProgramId programId = deserializeNext(arguments);
DatasetId datasetInstance = deserializeNext(arguments);
usageRegistry.register(programId, datasetInstance);
responder.sendStatus(HttpResponseStatus.OK);
}
use of co.cask.cdap.common.internal.remote.MethodArgument in project cdap by caskdata.
the class RemoteUsageRegistryHandler method registerStream.
@POST
@Path("/registerStream")
public void registerStream(FullHttpRequest request, HttpResponder responder) throws Exception {
Iterator<MethodArgument> arguments = parseArguments(request);
ProgramId programId = deserializeNext(arguments);
StreamId streamId = deserializeNext(arguments);
usageRegistry.register(programId, streamId);
responder.sendStatus(HttpResponseStatus.OK);
}
Aggregations