Search in sources :

Example 1 with AppSystemMetadataWriter

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);
    }
}
Also used : ApplicationSpecification(co.cask.cdap.api.app.ApplicationSpecification) DatasetSystemMetadataWriter(co.cask.cdap.data2.metadata.system.DatasetSystemMetadataWriter) ProgramSystemMetadataWriter(co.cask.cdap.data2.metadata.system.ProgramSystemMetadataWriter) ViewSystemMetadataWriter(co.cask.cdap.data2.metadata.system.ViewSystemMetadataWriter) SystemMetadataWriter(co.cask.cdap.data2.metadata.system.SystemMetadataWriter) AppSystemMetadataWriter(co.cask.cdap.data2.metadata.system.AppSystemMetadataWriter) ArtifactSystemMetadataWriter(co.cask.cdap.data2.metadata.system.ArtifactSystemMetadataWriter) StreamSystemMetadataWriter(co.cask.cdap.data2.metadata.system.StreamSystemMetadataWriter) ApplicationId(co.cask.cdap.proto.id.ApplicationId) AppSystemMetadataWriter(co.cask.cdap.data2.metadata.system.AppSystemMetadataWriter)

Example 2 with AppSystemMetadataWriter

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);
}
Also used : ApplicationSpecification(co.cask.cdap.api.app.ApplicationSpecification) SystemMetadataWriter(co.cask.cdap.data2.metadata.system.SystemMetadataWriter) AppSystemMetadataWriter(co.cask.cdap.data2.metadata.system.AppSystemMetadataWriter) ProgramSystemMetadataWriter(co.cask.cdap.data2.metadata.system.ProgramSystemMetadataWriter) ApplicationId(co.cask.cdap.proto.id.ApplicationId) AppSystemMetadataWriter(co.cask.cdap.data2.metadata.system.AppSystemMetadataWriter)

Aggregations

ApplicationSpecification (co.cask.cdap.api.app.ApplicationSpecification)2 AppSystemMetadataWriter (co.cask.cdap.data2.metadata.system.AppSystemMetadataWriter)2 ProgramSystemMetadataWriter (co.cask.cdap.data2.metadata.system.ProgramSystemMetadataWriter)2 SystemMetadataWriter (co.cask.cdap.data2.metadata.system.SystemMetadataWriter)2 ApplicationId (co.cask.cdap.proto.id.ApplicationId)2 ArtifactSystemMetadataWriter (co.cask.cdap.data2.metadata.system.ArtifactSystemMetadataWriter)1 DatasetSystemMetadataWriter (co.cask.cdap.data2.metadata.system.DatasetSystemMetadataWriter)1 StreamSystemMetadataWriter (co.cask.cdap.data2.metadata.system.StreamSystemMetadataWriter)1 ViewSystemMetadataWriter (co.cask.cdap.data2.metadata.system.ViewSystemMetadataWriter)1