use of co.cask.cdap.data2.metadata.lineage.AccessType in project cdap by caskdata.
the class RemoteLineageWriterHandler method addStreamAccess.
@POST
@Path("/addStreamAccess")
public void addStreamAccess(HttpRequest request, HttpResponder responder) throws Exception {
Iterator<MethodArgument> arguments = parseArguments(request);
ProgramRunId run = deserializeNext(arguments);
StreamId stream = deserializeNext(arguments);
AccessType accessType = deserializeNext(arguments);
NamespacedEntityId component = deserializeNext(arguments);
lineageWriter.addAccess(run, stream, accessType, component);
responder.sendStatus(HttpResponseStatus.OK);
}
use of co.cask.cdap.data2.metadata.lineage.AccessType in project cdap by caskdata.
the class RemoteLineageWriterHandler method addDatasetAccess.
@POST
@Path("/addDatasetAccess")
public void addDatasetAccess(HttpRequest request, HttpResponder responder) throws Exception {
Iterator<MethodArgument> arguments = parseArguments(request);
ProgramRunId run = deserializeNext(arguments);
DatasetId datasetInstance = deserializeNext(arguments);
AccessType accessType = deserializeNext(arguments);
NamespacedEntityId component = deserializeNext(arguments);
lineageWriter.addAccess(run, datasetInstance, accessType, component);
responder.sendStatus(HttpResponseStatus.OK);
}
use of co.cask.cdap.data2.metadata.lineage.AccessType in project cdap by caskdata.
the class RemoteLineageWriterHandler method addDatasetAccess.
@POST
@Path("/addDatasetAccess")
public void addDatasetAccess(FullHttpRequest request, HttpResponder responder) throws Exception {
Iterator<MethodArgument> arguments = parseArguments(request);
ProgramRunId run = deserializeNext(arguments);
DatasetId datasetInstance = deserializeNext(arguments);
AccessType accessType = deserializeNext(arguments);
NamespacedEntityId component = deserializeNext(arguments);
lineageWriter.addAccess(run, datasetInstance, accessType, component);
responder.sendStatus(HttpResponseStatus.OK);
}
use of co.cask.cdap.data2.metadata.lineage.AccessType in project cdap by caskdata.
the class RemoteLineageWriterHandler method addStreamAccess.
@POST
@Path("/addStreamAccess")
public void addStreamAccess(FullHttpRequest request, HttpResponder responder) throws Exception {
Iterator<MethodArgument> arguments = parseArguments(request);
ProgramRunId run = deserializeNext(arguments);
StreamId stream = deserializeNext(arguments);
AccessType accessType = deserializeNext(arguments);
NamespacedEntityId component = deserializeNext(arguments);
lineageWriter.addAccess(run, stream, accessType, component);
responder.sendStatus(HttpResponseStatus.OK);
}
use of co.cask.cdap.data2.metadata.lineage.AccessType in project cdap by caskdata.
the class LineageWriterDatasetFramework method getDataset.
@Nullable
@Override
public <T extends Dataset> T getDataset(final DatasetId datasetInstanceId, final Map<String, String> arguments, @Nullable final ClassLoader classLoader, final DatasetClassLoaderProvider classLoaderProvider, @Nullable final Iterable<? extends EntityId> owners, final AccessType accessType) throws DatasetManagementException, IOException {
Principal principal = authenticationContext.getPrincipal();
try {
// For system, skip authorization and lineage (user program shouldn't allow to access system dataset CDAP-6649)
// For non-system dataset, always perform authorization and lineage.
AuthorizationEnforcer enforcer;
DefaultDatasetRuntimeContext.DatasetAccessRecorder accessRecorder;
if (!DatasetsUtil.isUserDataset(datasetInstanceId)) {
enforcer = SYSTEM_NAMESPACE_ENFORCER;
accessRecorder = SYSTEM_NAMESPACE_ACCESS_RECORDER;
} else {
enforcer = authorizationEnforcer;
accessRecorder = new BasicDatasetAccessRecorder(datasetInstanceId, accessType, owners);
}
return DefaultDatasetRuntimeContext.execute(enforcer, accessRecorder, principal, datasetInstanceId, getConstructorDefaultAnnotation(accessType), new Callable<T>() {
@Override
public T call() throws Exception {
return LineageWriterDatasetFramework.super.getDataset(datasetInstanceId, arguments, classLoader, classLoaderProvider, owners, accessType);
}
});
} catch (IOException | DatasetManagementException | ServiceUnavailableException e) {
throw e;
} catch (Exception e) {
throw new DatasetManagementException("Failed to create dataset instance: " + datasetInstanceId, e);
}
}
Aggregations