use of co.cask.cdap.data2.metadata.store.MetadataStore in project cdap by caskdata.
the class ArtifactRepository method writeSystemMetadata.
private void writeSystemMetadata(co.cask.cdap.proto.id.ArtifactId artifactId, ArtifactInfo artifactInfo) {
// add system metadata for artifacts
ArtifactSystemMetadataWriter writer = new ArtifactSystemMetadataWriter(metadataStore, artifactId, artifactInfo);
writer.write();
}
use of co.cask.cdap.data2.metadata.store.MetadataStore in project cdap by caskdata.
the class ViewAdmin method createOrUpdate.
public boolean createOrUpdate(StreamViewId viewId, ViewSpecification spec) throws Exception {
try {
ViewSpecification previousSpec = store.get(viewId);
if (spec.getTableName() == null) {
// use the previous table name
spec = new ViewSpecification(spec.getFormat(), previousSpec.getTableName());
} else if (!spec.getTableName().equals(previousSpec.getTableName())) {
throw new IllegalArgumentException(String.format("Cannot change table name for view %s", viewId));
}
explore.disableExploreStream(viewId.getParent(), previousSpec.getTableName());
} catch (NotFoundException e) {
// pass through
}
if (spec.getTableName() == null) {
spec = new ViewSpecification(spec.getFormat(), naming.getTableName(viewId));
}
explore.enableExploreStream(viewId.getParent(), spec.getTableName(), spec.getFormat());
boolean result = store.createOrUpdate(viewId, spec);
ViewSystemMetadataWriter systemMetadataWriter = new ViewSystemMetadataWriter(metadataStore, viewId, spec, !result);
systemMetadataWriter.write();
return result;
}
Aggregations