use of co.cask.cdap.data2.metadata.store.MetadataStore in project cdap by caskdata.
the class ExistingEntitySystemMetadataWriter method writeSystemMetadataForPrograms.
private void writeSystemMetadataForPrograms(ApplicationId app, ProgramType programType, Collection<? extends ProgramSpecification> programSpecs) {
for (ProgramSpecification programSpec : programSpecs) {
ProgramId programId = app.program(programType, programSpec.getName());
SystemMetadataWriter writer = new ProgramSystemMetadataWriter(metadataStore, programId, programSpec, true);
writer.write();
}
}
use of co.cask.cdap.data2.metadata.store.MetadataStore in project cdap by caskdata.
the class ExistingEntitySystemMetadataWriter method writeSystemMetadataForStreams.
private void writeSystemMetadataForStreams(NamespaceId namespace) throws Exception {
for (StreamSpecification streamSpec : store.getAllStreams(namespace)) {
StreamId streamId = namespace.stream(streamSpec.getName());
SystemMetadataWriter writer = new StreamSystemMetadataWriter(metadataStore, streamId, streamAdmin.getConfig(streamId), streamSpec.getDescription());
writer.write();
for (StreamViewId view : streamAdmin.listViews(streamId)) {
writer = new ViewSystemMetadataWriter(metadataStore, view, viewAdmin.get(view), true);
writer.write();
}
}
}
use of co.cask.cdap.data2.metadata.store.MetadataStore in project cdap by caskdata.
the class ExistingEntitySystemMetadataWriter method writeSystemMetadataForDatasets.
private void writeSystemMetadataForDatasets(NamespaceId namespace, DatasetFramework dsFramework) throws DatasetManagementException, IOException, NamespaceNotFoundException {
SystemDatasetInstantiatorFactory systemDatasetInstantiatorFactory = new SystemDatasetInstantiatorFactory(locationFactory, dsFramework, cConf);
try (SystemDatasetInstantiator systemDatasetInstantiator = systemDatasetInstantiatorFactory.create()) {
for (DatasetSpecificationSummary summary : dsFramework.getInstances(namespace)) {
final DatasetId dsInstance = namespace.dataset(summary.getName());
DatasetProperties dsProperties = DatasetProperties.of(summary.getProperties());
String dsType = summary.getType();
Dataset dataset = null;
try {
try {
dataset = impersonator.doAs(dsInstance, new Callable<Dataset>() {
@Override
public Dataset call() throws Exception {
return systemDatasetInstantiator.getDataset(dsInstance);
}
});
} catch (Exception e) {
LOG.warn("Exception while instantiating dataset {}", dsInstance, e);
}
SystemMetadataWriter writer = new DatasetSystemMetadataWriter(metadataStore, dsInstance, dsProperties, dataset, dsType, summary.getDescription());
writer.write();
} finally {
if (dataset != null) {
dataset.close();
}
}
}
}
}
use of co.cask.cdap.data2.metadata.store.MetadataStore in project cdap by caskdata.
the class ExistingEntitySystemMetadataWriter method writeSystemMetadataForApps.
private void writeSystemMetadataForApps(NamespaceId namespace) {
for (ApplicationSpecification appSpec : store.getAllApplications(namespace)) {
ApplicationId app = namespace.app(appSpec.getName());
SystemMetadataWriter writer = new AppSystemMetadataWriter(metadataStore, app, appSpec);
writer.write();
writeSystemMetadataForPrograms(app, appSpec);
}
}
use of co.cask.cdap.data2.metadata.store.MetadataStore in project cdap by caskdata.
the class ExistingEntitySystemMetadataWriter method writeSystemMetadataForArtifacts.
private void writeSystemMetadataForArtifacts(NamespaceId namespace) throws IOException {
for (ArtifactDetail artifactDetail : artifactStore.getArtifacts(namespace)) {
co.cask.cdap.api.artifact.ArtifactId artifact = artifactDetail.getDescriptor().getArtifactId();
ArtifactInfo artifactInfo = new ArtifactInfo(artifact, artifactDetail.getMeta().getClasses(), artifactDetail.getMeta().getProperties());
ArtifactId artifactId = namespace.artifact(artifact.getName(), artifact.getVersion().getVersion());
SystemMetadataWriter writer = new ArtifactSystemMetadataWriter(metadataStore, artifactId, artifactInfo);
writer.write();
}
}
Aggregations