static Collection<DatasetSpecificationSummary> spec2Summary(Collection<DatasetSpecification> specs) { List<DatasetSpecificationSummary> datasetSummaries = Lists.newArrayList(); for (DatasetSpecification spec : specs) { // TODO: (CDAP-3097) handle system datasets specially within a namespace instead of filtering them out // by the handler. This filter is only in the list endpoint because the other endpoints are used by // HBaseQueueAdmin through DatasetFramework. spec = DatasetsUtil.fixOriginalProperties(spec); datasetSummaries.add(new DatasetSpecificationSummary(spec.getName(), spec.getType(), spec.getDescription(), spec.getOriginalProperties())); } return datasetSummaries; }
static Collection<DatasetSpecificationSummary> spec2Summary(Collection<DatasetSpecification> specs) { List<DatasetSpecificationSummary> datasetSummaries = Lists.newArrayList(); for (DatasetSpecification spec : specs) { // TODO: (CDAP-3097) handle system datasets specially within a namespace instead of filtering them out // by the handler. This filter is only in the list endpoint because the other endpoints are used by // HBaseQueueAdmin through DatasetFramework. if (QueueConstants.STATE_STORE_NAME.equals(spec.getName())) { continue; } spec = DatasetsUtil.fixOriginalProperties(spec); datasetSummaries.add(new DatasetSpecificationSummary(spec.getName(), spec.getType(), spec.getDescription(), spec.getOriginalProperties())); } return datasetSummaries; }
@Override public DatasetCreationResponse update(DatasetId datasetInstanceId, DatasetTypeMeta typeMeta, DatasetProperties props, DatasetSpecification existing) throws Exception { DatasetType type = client.getDatasetType(typeMeta, null, new ConstantClassLoaderProvider()); if (type == null) { throw new IllegalArgumentException("Dataset type cannot be instantiated for provided type meta: " + typeMeta); } try { DatasetSpecification spec = type.reconfigure(datasetInstanceId.getEntityName(), props, existing); DatasetAdmin admin = type.getAdmin(DatasetContext.from(datasetInstanceId.getNamespace()), spec); if (admin instanceof Updatable) { ((Updatable) admin).update(existing); } else { admin.create(); } if (spec.getDescription() == null && existing.getDescription() != null) { spec.setDescription(existing.getDescription()); } return new DatasetCreationResponse(spec, null); } catch (IncompatibleUpdateException e) { throw new ConflictException(e.getMessage()); } }
@Override public DatasetCreationResponse update(DatasetId datasetInstanceId, DatasetTypeMeta typeMeta, DatasetProperties props, DatasetSpecification existing) throws Exception { DatasetType type = client.getDatasetType(typeMeta, null, new ConstantClassLoaderProvider()); if (type == null) { throw new IllegalArgumentException("Dataset type cannot be instantiated for provided type meta: " + typeMeta); } try { DatasetSpecification spec = type.reconfigure(datasetInstanceId.getEntityName(), props, existing); DatasetAdmin admin = type.getAdmin(DatasetContext.from(datasetInstanceId.getNamespace()), spec); if (admin instanceof Updatable) { ((Updatable) admin).update(existing); } else { admin.create(); } if (spec.getDescription() == null && existing.getDescription() != null) { spec.setDescription(existing.getDescription()); } return new DatasetCreationResponse(spec, null); } catch (IncompatibleUpdateException e) { throw new ConflictException(e.getMessage()); } }
metadataProvider = new DatasetSystemMetadataProvider(datasetInstanceId, props, dataset, typeMeta.getName(), spec.getDescription()); } else { long createTime = System.currentTimeMillis(); metadataProvider = new DatasetSystemMetadataProvider(datasetInstanceId, props, createTime, dataset, typeMeta.getName(), spec.getDescription());
metadataProvider = new DatasetSystemMetadataProvider(datasetInstanceId, props, dataset, typeMeta.getName(), spec.getDescription()); } else { long createTime = System.currentTimeMillis(); metadataProvider = new DatasetSystemMetadataProvider(datasetInstanceId, props, createTime, dataset, typeMeta.getName(), spec.getDescription());
private DatasetSpecificationSummary spec2Summary(DatasetSpecification spec) { return new DatasetSpecificationSummary(spec.getName(), spec.getType(), spec.getDescription(), spec.getOriginalProperties()); }