use of com.netflix.metacat.common.MetacatRequestContext in project metacat by Netflix.
the class PartitionServiceImpl method getPartitionUris.
/**
* {@inheritDoc}
*/
@Override
public List<String> getPartitionUris(final QualifiedName name, @Nullable final Sort sort, @Nullable final Pageable pageable, @Nullable final GetPartitionsRequestDto getPartitionsRequestDto) {
List<String> result = Lists.newArrayList();
if (tableService.exists(name)) {
final MetacatRequestContext metacatRequestContext = MetacatContextManager.getContext();
final ConnectorPartitionService service = connectorManager.getPartitionService(name);
final ConnectorRequestContext connectorRequestContext = converterUtil.toConnectorContext(metacatRequestContext);
try {
result = service.getPartitionUris(connectorRequestContext, name, converterUtil.toPartitionListRequest(getPartitionsRequestDto, pageable, sort));
} catch (final UnsupportedOperationException uoe) {
log.info("Catalog {} doesn't support getPartitionUris. Ignoring.", name.getCatalogName());
}
}
return result;
}
use of com.netflix.metacat.common.MetacatRequestContext in project metacat by Netflix.
the class PartitionServiceImpl method count.
/**
* {@inheritDoc}
*/
@Override
public Integer count(final QualifiedName name) {
Integer result = 0;
if (tableService.exists(name)) {
final MetacatRequestContext metacatRequestContext = MetacatContextManager.getContext();
final ConnectorPartitionService service = connectorManager.getPartitionService(name);
final ConnectorRequestContext connectorRequestContext = converterUtil.toConnectorContext(metacatRequestContext);
result = service.getPartitionCount(connectorRequestContext, name);
}
return result;
}
use of com.netflix.metacat.common.MetacatRequestContext in project metacat by Netflix.
the class PartitionServiceImpl method getPartitionKeys.
/**
* {@inheritDoc}
*/
@Override
public List<String> getPartitionKeys(final QualifiedName name, @Nullable final Sort sort, @Nullable final Pageable pageable, @Nullable final GetPartitionsRequestDto getPartitionsRequestDto) {
List<String> result = Lists.newArrayList();
if (tableService.exists(name)) {
final MetacatRequestContext metacatRequestContext = MetacatContextManager.getContext();
final ConnectorPartitionService service = connectorManager.getPartitionService(name);
final ConnectorRequestContext connectorRequestContext = converterUtil.toConnectorContext(metacatRequestContext);
try {
result = service.getPartitionKeys(connectorRequestContext, name, converterUtil.toPartitionListRequest(getPartitionsRequestDto, pageable, sort));
} catch (final UnsupportedOperationException uoe) {
log.debug("Catalog {} doesn't support getPartitionKeys. Ignoring.", name.getCatalogName());
}
}
return result;
}
use of com.netflix.metacat.common.MetacatRequestContext in project metacat by Netflix.
the class TableServiceImpl method saveMetadata.
/**
* {@inheritDoc}
*/
@Override
public void saveMetadata(final QualifiedName name, final ObjectNode definitionMetadata, final ObjectNode dataMetadata) {
validate(name);
final Optional<TableDto> tableDtoOptional = get(name, GetTableServiceParameters.builder().includeInfo(true).disableOnReadMetadataIntercetor(true).includeDefinitionMetadata(false).includeDataMetadata(false).build());
if (tableDtoOptional.isPresent()) {
final MetacatRequestContext metacatRequestContext = MetacatContextManager.getContext();
final TableDto tableDto = tableDtoOptional.get();
// override the previous one
tableDto.setDefinitionMetadata(definitionMetadata);
tableDto.setDataMetadata(dataMetadata);
log.info("Saving user metadata for table {}", name);
userMetadataService.saveMetadata(metacatRequestContext.getUserName(), tableDto, true);
tag(name, tableDto.getDefinitionMetadata());
}
}
use of com.netflix.metacat.common.MetacatRequestContext in project metacat by Netflix.
the class TableServiceImpl method getQualifiedNames.
/**
* {@inheritDoc}
*/
@Override
public Map<String, List<QualifiedName>> getQualifiedNames(final List<String> uris, final boolean prefixSearch) {
final Map<String, List<QualifiedName>> result = Maps.newHashMap();
connectorManager.getTableServices().forEach(service -> {
final MetacatRequestContext metacatRequestContext = MetacatContextManager.getContext();
final ConnectorRequestContext connectorRequestContext = converterUtil.toConnectorContext(metacatRequestContext);
try {
final Map<String, List<QualifiedName>> names = service.getTableNames(connectorRequestContext, uris, prefixSearch);
names.forEach((uri, qNames) -> {
final List<QualifiedName> existingNames = result.get(uri);
if (existingNames == null) {
result.put(uri, qNames);
} else {
existingNames.addAll(qNames);
}
});
} catch (final UnsupportedOperationException uoe) {
log.debug("Table service doesn't support getting table names by URI. Skipping");
}
});
return result;
}
Aggregations