All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.spals.appbuilder.graph.model.ServiceGraphs Maven / Gradle / Ivy

There is a newer version: 0.6.5
Show newest version
package net.spals.appbuilder.graph.model;

import net.spals.appbuilder.config.service.ServiceScan;

import java.util.concurrent.atomic.AtomicReference;

/**
 * @author tkral
 */
public class ServiceGraphs {

    private final String applicationName;
    private final ServiceScan serviceScan;

    private final ServiceGraph serviceGraph;

    private final AtomicReference serviceDAGRef = new AtomicReference<>(null);
    private final AtomicReference serviceTreeRef = new AtomicReference<>(null);

    public ServiceGraphs(final String applicationName,
                         final ServiceGraph serviceGraph,
                         final ServiceScan serviceScan) {
        this.applicationName = applicationName;
        this.serviceGraph = serviceGraph;
        this.serviceScan = serviceScan;
    }

    public ServiceGraph getServiceGraph() {
        return serviceGraph;
    }

    public ServiceDAG getServiceDAG() {
        serviceDAGRef.compareAndSet(null,
            new ServiceDAGConverter(applicationName, serviceScan).convertFrom(serviceGraph));
        return serviceDAGRef.get();
    }

    public ServiceTree getServiceTree() {
        serviceTreeRef.compareAndSet(null,
            new ServiceTreeConverter().convertFrom(getServiceDAG()));
        return serviceTreeRef.get();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy