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

com.xti.spring.cloud.heroku.discovery.process.HerokuSpaceTopologyServiceProvider Maven / Gradle / Ivy

The newest version!
package com.xti.spring.cloud.heroku.discovery.process;

import com.xti.spring.cloud.heroku.discovery.topology.HerokuSpaceTopologyListener;
import com.xti.spring.cloud.heroku.discovery.topology.HerokuSpaceTopologyApp;
import com.xti.spring.cloud.heroku.discovery.topology.HerokuSpaceTopologyProcess;
import com.xti.spring.cloud.heroku.discovery.topology.HerokuSpaceTopologyV1;

import java.util.ArrayList;
import java.util.List;

public class HerokuSpaceTopologyServiceProvider implements HerokuServiceProvider {

    private HerokuSpaceTopologyListener listener;

    public HerokuSpaceTopologyServiceProvider(HerokuSpaceTopologyListener listener) {
        this.listener = listener;
    }

    @Override
    public List getProcesses() {
        HerokuSpaceTopologyV1 topology = listener.getTopology();
        List processes = new ArrayList<>();

        if(topology != null){
            for (HerokuSpaceTopologyApp app : topology.getApps()) {
                String appName = app.getAppName();

                if(appName != null){
                    for (HerokuSpaceTopologyProcess process : app.getFormation()) {
                        processes.add(process.getProcessType() + "." + appName);
                    }
                }

            }
        }

        return processes;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy