use of co.cask.cdap.data2.metadata.system.AppSystemMetadataWriter 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.system.AppSystemMetadataWriter in project cdap by caskdata.
the class SystemMetadataWriterStage method process.
@Override
public void process(ApplicationWithPrograms input) throws Exception {
// add system metadata for apps
ApplicationId appId = input.getApplicationId();
ApplicationSpecification appSpec = input.getSpecification();
// only update creation time if this is a new app
Map<String, String> properties = metadataStore.getProperties(MetadataScope.SYSTEM, appId);
SystemMetadataWriter appSystemMetadataWriter = new AppSystemMetadataWriter(metadataStore, appId, appSpec, !properties.isEmpty());
appSystemMetadataWriter.write();
// add system metadata for programs
writeProgramSystemMetadata(appId, ProgramType.FLOW, appSpec.getFlows().values());
writeProgramSystemMetadata(appId, ProgramType.MAPREDUCE, appSpec.getMapReduce().values());
writeProgramSystemMetadata(appId, ProgramType.SERVICE, appSpec.getServices().values());
writeProgramSystemMetadata(appId, ProgramType.SPARK, appSpec.getSpark().values());
writeProgramSystemMetadata(appId, ProgramType.WORKER, appSpec.getWorkers().values());
writeProgramSystemMetadata(appId, ProgramType.WORKFLOW, appSpec.getWorkflows().values());
// Emit input to the next stage
emit(input);
}
Aggregations